Now speaks IPv6, if config contains a ":" in host

这个提交包含在:
Bandie Canis
2017-10-03 00:05:23 +02:00
父节点 43bac5ed2c
当前提交 03635184ae
共有 2 个文件被更改,包括 8 次插入2 次删除

查看文件

@@ -63,7 +63,10 @@ def main():
print("Please check your paths in the config file. (Have you forgotten to generate the Certificates?)", sep="", file=sys.stderr) print("Please check your paths in the config file. (Have you forgotten to generate the Certificates?)", sep="", file=sys.stderr)
quit(2) quit(2)
conn = context.wrap_socket(socket.socket()) if(":" in host):
conn = context.wrap_socket(socket.socket(family=socket.AF_INET6))
else:
conn = context.wrap_socket(socket.socket(family=socket.AF_INET))
try: try:

查看文件

@@ -102,7 +102,10 @@ def init():
quit(2) quit(2)
try: try:
bindsocket = socket.socket() if(":" in host):
bindsocket = socket.socket(family=socket.AF_INET6)
else:
bindsocket = socket.socket(family=socket.AF_INET)
bindsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) bindsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
bindsocket.bind((host, port)) bindsocket.bind((host, port))
bindsocket.listen(5) bindsocket.listen(5)