Beispiel #1
0
    def handleAccept(self, rc, evt):
        if self.disconnecting or self.disconnected:
            return False

        # possible errors:
        # (WSAEMFILE, WSAENOBUFS, WSAENFILE, WSAENOMEM, WSAECONNABORTED)
        if rc:
            log.msg("Could not accept new connection -- %s (%s)" %
                    (errno.errorcode.get(rc, 'unknown error'), rc))
            return False
        else:
            evt.newskt.setsockopt(socket.SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT,
                                  struct.pack('I', self.socket.fileno()))
            family, lAddr, rAddr = _iocp.get_accept_addrs(
                evt.newskt.fileno(), evt.buff)
            assert family == self.addressFamily

            protocol = self.factory.buildProtocol(
                address._ServerFactoryIPv4Address('TCP', rAddr[0], rAddr[1]))
            if protocol is None:
                evt.newskt.close()
            else:
                s = self.sessionno
                self.sessionno = s + 1
                transport = Server(
                    evt.newskt, protocol,
                    address.IPv4Address('TCP', rAddr[0], rAddr[1], 'INET'),
                    address.IPv4Address('TCP', lAddr[0], lAddr[1], 'INET'), s,
                    self.reactor)
                protocol.makeConnection(transport)
            return True
Beispiel #2
0
    def getPeer(self):
        """
		Returns an IPv4Address.

		This indicates the address that I am connected to.
		"""
        return address.IPv4Address('TCP', *(self.realAddress + ('INET', )))
Beispiel #3
0
    def getHost(self):
        """Returns an IPv4Address.

		This indicates the server's address.
		"""
        return address.IPv4Address('TCP',
                                   *(self.socket.getsockname() + ('INET', )))
Beispiel #4
0
    def getHost(self):
        """Returns an IPv4Address.

		This indicates the address from which I am connecting.
		"""
        return address.IPv4Address('TCP',
                                   *(self.socket.getsockname() + ('INET', )))
Beispiel #5
0
	def getDestination(self):
		return address.IPv4Address('TCP', self.host, self.port, 'SSL')
Beispiel #6
0
	def getPeer(self):
		"""Return address of peer."""
		h, p = self.client
		return address.IPv4Address('TCP', h, p, 'SSL')
Beispiel #7
0
	def getHost(self):
		"""Return server's address."""
		h, p = self.socket.getsockname()
		return address.IPv4Address('TCP', h, p, 'SSL')
Beispiel #8
0
	def getPeer(self):
		"""Returns the address that I am connected."""
		return address.IPv4Address('TCP', self.addr[0], self.addr[1], 'SSL')
Beispiel #9
0
	def getHost(self):
		"""Returns the address from which I am connecting."""
		h, p = self.socket.getsockname()
		return address.IPv4Address('TCP', h, p, 'SSL')
Beispiel #10
0
    def getPeer(self):
        """Returns an IPv4Address.

		This indicates the client's address.
		"""
        return address.IPv4Address('TCP', *(self.client + ('INET', )))