def __init__(self, poller, parent, endpoint, prefer_ipv6, sslconfig, extra): Pollable.__init__(self) self.poller = poller self.epnts = collections.deque() self.parent = parent self.prefer_ipv6 = prefer_ipv6 self.sslconfig = sslconfig self.extra = extra self.sock = None self.timestamp = 0 self.watchdog = 10 self.aterror = Deferred() self.aterror.add_callback(self.parent.handle_connect_error) # For logging purpose, save original endpoint self.endpoint = endpoint if " " in endpoint[0]: for address in endpoint[0].split(): tmp = (address.strip(), endpoint[1]) self.epnts.append(tmp) else: self.epnts.append(endpoint) self._connect()
def __init__(self, poller, sock, connection_made, connection_lost, sslconfig, sslcert, opaque): Pollable.__init__(self) self.poller = poller self.filenum = sock.fileno() self.myname = utils_net.getsockname(sock) self.peername = utils_net.getpeername(sock) self.logname = '%s %s' % (utils_net.format_epnt(self.myname), utils_net.format_epnt(self.peername)) logging.debug('stream: __init__(): %s', self.logname) # Variables pointing to other objects self.atclose = Deferred() self.atconnect = Deferred() self.opaque = opaque self.recv_complete = None self.send_complete = None self.send_octets = EMPTY_STRING self.sock = None # Variables we don't need to clear self.bytes_in = 0 self.bytes_out = 0 self.conn_rst = False self.eof = False self.isclosed = False self.recv_bytes = 0 self.recv_blocked = False self.send_blocked = False self.atclose.add_callback(connection_lost) self.atconnect.add_callback(connection_made) self.atconnect.add_errback(self._connection_made_error) if not sslconfig: self.sock = _stream_wrapper(sock) self.atconnect.callback(self) return # # Lazy import: this fails on Python 2.5, because SSL is not part of # v2.5 standard library. We do not intercept the error here, because # accept() code already needs to setup a try..except to route any # error away from the listening socket. # from . import sslstream # # If there is SSL support, initialise() deals transparently with SSL # negotiation, and invokes connection_made() when done. Errors are # routed to the self.poller, which generates CLOSE events accordingly. # sslstream.initialise(self.poller, self, sock, sslcert)
def __init__(self, parent, sock, endpoint): Pollable.__init__(self) self.parent = parent self.lsock = sock self.endpoint = endpoint # Want to listen "forever" self.watchdog = -1 POLLER.set_readable(self) self.parent.handle_listen(self)
def __init__(self, poller, parent, sock, endpoint, sslconfig, sslcert): Pollable.__init__(self) self.poller = poller self.parent = parent self.lsock = sock self.endpoint = endpoint self.sslconfig = sslconfig self.sslcert = sslcert # Want to listen "forever" self.watchdog = -1 self.poller.set_readable(self) self.parent.handle_listen(self)
def __init__(self, poller, stream): Pollable.__init__(self) self.poller = poller self.opaque = stream
def __init__(self, stream): Pollable.__init__(self) self.opaque = stream