def connect(self, endpoint, conf): self.endpoint = endpoint self.family = socket.AF_INET if conf["net.stream.ipv6"]: self.family = socket.AF_INET6 rcvbuf = conf["net.stream.rcvbuf"] sndbuf = conf["net.stream.sndbuf"] try: addrinfo = getaddrinfo(endpoint[0], endpoint[1], self.family, socket.SOCK_STREAM) except socket.error, exception: LOG.error("* Connection to %s failed: %s" % (endpoint, exception)) self.parent._connection_failed(self, exception) return
def listen(self, endpoint, conf): self.endpoint = endpoint self.family = socket.AF_INET if conf["net.stream.ipv6"]: self.family = socket.AF_INET6 rcvbuf = conf["net.stream.rcvbuf"] sndbuf = conf["net.stream.sndbuf"] try: addrinfo = getaddrinfo(endpoint[0], endpoint[1], self.family, socket.SOCK_STREAM, 0, socket.AI_PASSIVE) except socket.error, exception: LOG.error("* Bind %s failed: %s" % (self.endpoint, exception)) self.parent.bind_failed(self, exception) return
def connect(self, endpoint, conf, measurer=None): self.endpoint = endpoint self.family = socket.AF_INET if conf.get("net.stream.ipv6", False): self.family = socket.AF_INET6 self.measurer = measurer rcvbuf = conf.get("net.stream.rcvbuf", 0) sndbuf = conf.get("net.stream.sndbuf", 0) try: addrinfo = getaddrinfo(endpoint[0], endpoint[1], self.family, socket.SOCK_STREAM) except socket.error, exception: LOG.error("* Connection to %s failed: %s" % (endpoint, exception)) self.parent._connection_failed(self, exception) return