mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
commit
13f3cbed4f
@ -563,6 +563,7 @@ class TCPServer:
|
|||||||
# Only works if self.address == ""
|
# Only works if self.address == ""
|
||||||
self.socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
|
self.socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
|
||||||
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
|
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
||||||
self.socket.setsockopt(IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
|
self.socket.setsockopt(IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
|
||||||
self.socket.bind(self.address)
|
self.socket.bind(self.address)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
@ -574,6 +575,7 @@ class TCPServer:
|
|||||||
# Binding to an IPv6 socket failed, lets fall back to IPv4.
|
# Binding to an IPv6 socket failed, lets fall back to IPv4.
|
||||||
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
|
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
||||||
self.socket.bind(self.address)
|
self.socket.bind(self.address)
|
||||||
|
|
||||||
self.address = self.socket.getsockname()
|
self.address = self.socket.getsockname()
|
||||||
|
Loading…
Reference in New Issue
Block a user