def connect(self, host, port): self._stack_conn = _Connection() self._stack_conn.attach(self) self._stack_conn.connect_cb = Callback() factory = ClientFactory() factory.protocol = lambda: self._stack_conn factory.clientConnectionFailed = self.clientConnectionFailed if self.ssl_options is not None: reactor.connectSSL(host, port, factory, SSLContextFactory(self.ssl_options)) else: reactor.connectTCP(host, port, factory) yield self._stack_conn.connect_cb
def _connect_to_reactor(self, host, port, factory, timeout): reactor.connectTCP(host, port, factory, timeout=timeout)