Enable TCP_NODELAY if supported
This commit is contained in:
parent
d8453384ab
commit
5f37bf3eef
1 changed files with 8 additions and 0 deletions
|
@ -105,6 +105,10 @@ class Connection(object):
|
||||||
self.sock = self.server.tor_manager.createSocket(self.ip, self.port)
|
self.sock = self.server.tor_manager.createSocket(self.ip, self.port)
|
||||||
else:
|
else:
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
|
||||||
|
if "TCP_NODELAY" in dir(socket):
|
||||||
|
self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||||
|
|
||||||
self.sock.connect((self.ip, int(self.port)))
|
self.sock.connect((self.ip, int(self.port)))
|
||||||
|
|
||||||
# Implicit SSL
|
# Implicit SSL
|
||||||
|
@ -123,6 +127,10 @@ class Connection(object):
|
||||||
# Handle incoming connection
|
# Handle incoming connection
|
||||||
def handleIncomingConnection(self, sock):
|
def handleIncomingConnection(self, sock):
|
||||||
self.log("Incoming connection...")
|
self.log("Incoming connection...")
|
||||||
|
|
||||||
|
if "TCP_NODELAY" in dir(socket):
|
||||||
|
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||||
|
|
||||||
self.type = "in"
|
self.type = "in"
|
||||||
if self.ip not in config.ip_local: # Clearnet: Check implicit SSL
|
if self.ip not in config.ip_local: # Clearnet: Check implicit SSL
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue