Update server.py

This commit is contained in:
Nova Cat 2025-02-04 15:28:00 -08:00
parent c31aa0443a
commit fee8af6109

View file

@ -244,6 +244,7 @@ def session(connection, client, ip, isssl=False):
connection.do_handshake() connection.do_handshake()
tlsver = connection.version() tlsver = connection.version()
print(f"Got SSL version: {tlsver}") print(f"Got SSL version: {tlsver}")
connection.settimeout(None)
connection.sendall(bytes(f":{server} NOTICE * :*** Looking for your hostname...\r\n","UTF-8")) connection.sendall(bytes(f":{server} NOTICE * :*** Looking for your hostname...\r\n","UTF-8"))
connection.sendall(bytes(f":{server} NOTICE * :*** Checking your ident...\r\n","UTF-8")) connection.sendall(bytes(f":{server} NOTICE * :*** Checking your ident...\r\n","UTF-8"))
try: try:
@ -272,11 +273,14 @@ def session(connection, client, ip, isssl=False):
cause = "Remote host closed the connection" cause = "Remote host closed the connection"
break break
except ssl.SSLEOFError: except ssl.SSLEOFError:
print("EOF occurred.")
pass pass
except ssl.SSLZeroReturnError: except ssl.SSLZeroReturnError:
print(traceback.format_exc())
cause = "Remote host closed the connection" cause = "Remote host closed the connection"
break break
except Exception as ex: except Exception as ex:
print(traceback.format_exc())
cause = "Read error: " + str(ex) cause = "Read error: " + str(ex)
break break
print("Received data: {}".format(data)) print("Received data: {}".format(data))
@ -738,8 +742,6 @@ def session(connection, client, ip, isssl=False):
textt = "" textt = ""
connection.sendall(bytes(pendingSend, "UTF-8")) connection.sendall(bytes(pendingSend, "UTF-8"))
pendingSend = "" pendingSend = ""
except ssl.SSLEOFError:
print("EOF occured...")
except Exception as ex: except Exception as ex:
print(traceback.format_exc()) print(traceback.format_exc())
cause = "" + str(ex) cause = "" + str(ex)