Пример #1
0
            def wrap_child(child):
                log.debug("Wrapping child socket - about to handshake! parent=%s", self._sock, extra={"sock": child})
                child._wrapper_socket = self.context.wrap_socket(
                    _socketobject(_sock=child),
                    do_handshake_on_connect=self.do_handshake_on_connect,
                    suppress_ragged_eofs=self.suppress_ragged_eofs,
                    server_side=True)

                if self.do_handshake_on_connect:
                    child._wrapper_socket.do_handshake()
Пример #2
0
 def accept(self):
     """Accepts a new connection from a remote client, and returns
     a tuple containing that new connection wrapped with a server-side
     SSL channel, and the address of the remote client."""
     child, addr = self._sock.accept()
     if self.do_handshake_on_connect:
         wrapped_child_socket = child._wrapper_socket
         del child._wrapper_socket
         return wrapped_child_socket, addr
     else:
         return self.context.wrap_socket(
             _socketobject(_sock=child),
             do_handshake_on_connect=self.do_handshake_on_connect,
             suppress_ragged_eofs=self.suppress_ragged_eofs,
             server_side=True)