Update server.py
All checks were successful
/ check (push) Successful in 29s

This commit is contained in:
Nova Cat 2025-01-26 00:46:02 -08:00
parent 46b6b0daf2
commit d6e507ad7f

View file

@ -759,19 +759,19 @@ def tcp_session(sock):
print("Something went wrong...") print("Something went wrong...")
print(traceback.format_exc()) print(traceback.format_exc())
def ssl_session(sock2): def ssl_session(sock2):
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) while True:
context.load_cert_chain(ssl_cert, keyfile=ssl_pkey) try:
with context.wrap_socket(sock2, server_side=True) as sock: while opened:
while True: context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
try: context.load_cert_chain(ssl_cert, keyfile=ssl_pkey)
while opened: with context.wrap_socket(sock2, server_side=True) as sock:
print("Waiting for connection...") print("Waiting for connection...")
connection, client = sock.accept() connection, client = sock.accept()
ip_to = restrict_ip ip_to = restrict_ip
threading.Thread(target=session, daemon=True, args=[connection, client, ip_to, True]).start() threading.Thread(target=session, daemon=True, args=[connection, client, ip_to, True]).start()
except: except:
print("Something went wrong...") print("Something went wrong...")
print(traceback.format_exc()) print(traceback.format_exc())
for ip, i in sockets.items(): for ip, i in sockets.items():
print("Now listening on port 6667 with IP " + ip) print("Now listening on port 6667 with IP " + ip)
threading.Thread(target=tcp_session, args=[i], daemon=True).start() threading.Thread(target=tcp_session, args=[i], daemon=True).start()