Commit 8d59cba0 authored by Jim Fulton's avatar Jim Fulton

Merge branch 'ssl' of github.com:zopefoundation/ZEO into ssl

parents 5fcd383e daca97cb
......@@ -50,7 +50,7 @@ from ZODB.POSException import TransactionError, ReadOnlyError, ConflictError
from ZODB.serialize import referencesf
from ZODB.utils import oid_repr, p64, u64, z64
from .asyncio.server import Acceptor
from .asyncio.mtacceptor import Acceptor
logger = logging.getLogger('ZEO.StorageServer')
......
......@@ -81,13 +81,8 @@ class Acceptor(asyncore.dispatcher):
asyncore.dispatcher.__init__(self, map=self.__socket_map)
self.ssl_context = ssl
if ssl is not None:
self.ssl_wrap_socket = ssl.wrap_socket
self._open_socket()
def ssl_wrap_socket(self, sock, server_side):
return sock
def _open_socket(self):
addr = self.addr
......@@ -165,17 +160,32 @@ class Acceptor(asyncore.dispatcher):
try:
logger.debug("new connection %s" % (addr,))
sock = self.ssl_wrap_socket(sock, server_side=True)
def run():
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
zs = self.storage_server.create_client_handler()
protocol = ServerProtocol(loop, self.addr, zs)
protocol.stop = loop.stop
asyncio.async(loop.create_connection((lambda : protocol),
sock=sock),
loop=loop)
if self.ssl_context is None:
cr = loop.create_connection((lambda : protocol), sock=sock)
else:
#######################################################
# XXX See http://bugs.python.org/issue27392 :(
_make_ssl_transport = loop._make_ssl_transport
def make_ssl_transport(*a, **kw):
kw['server_side'] = True
return _make_ssl_transport(*a, **kw)
loop._make_ssl_transport = make_ssl_transport
#
#######################################################
cr = loop.create_connection(
(lambda : protocol), sock=sock,
ssl=self.ssl_context,
server_hostname='fu' # http://bugs.python.org/issue27391
)
asyncio.async(cr, loop=loop)
loop.run_forever()
loop.close()
......
......@@ -1089,7 +1089,7 @@ def runzeo_without_configfile():
------
--T INFO ZEO.StorageServer StorageServer created RW with storages 1RWt
------
--T INFO ZEO.asyncio.server listening on ...
--T INFO ZEO.asyncio... listening on ...
------
--T INFO ZEO.StorageServer closing storage '1'
testing exit immediately
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment