From 25e830dd35fe725f30345ea07dddffdc38d84527 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Tue, 9 Aug 2016 19:16:19 -0400 Subject: [PATCH] Tighten up code in loop.connect_accepted_socket --- uvloop/loop.pyx | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index dab6c6b..6d41fd9 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -1930,31 +1930,23 @@ cdef class Loop: raise ValueError('invalid socket type, SOCK_STREAM expected') fileno = sock.fileno() - protocol = protocol_factory() + app_protocol = protocol_factory() waiter = self._new_future() if ssl is None: - if sock.family == uv.AF_UNIX: - transport = UnixTransport.new( - self, protocol, None, waiter) - - elif sock.family in (uv.AF_INET, uv.AF_INET6): - transport = TCPTransport.new( - self, protocol, None, waiter) - + protocol = app_protocol else: - ssl_protocol = aio_SSLProtocol( - self, protocol, ssl, waiter, + protocol = aio_SSLProtocol( + self, app_protocol, ssl, waiter, True, # server_side None) # server_hostname - if sock.family == uv.AF_UNIX: - transport = UnixTransport.new( - self, ssl_protocol, None, None) - - elif sock.family in (uv.AF_INET, uv.AF_INET6): - transport = TCPTransport.new( - self, ssl_protocol, None, None) + if sock.family == uv.AF_UNIX: + transport = UnixTransport.new( + self, protocol, None, waiter) + elif sock.family in (uv.AF_INET, uv.AF_INET6): + transport = TCPTransport.new( + self, protocol, None, waiter) if transport is None: raise ValueError(