Update server.py
Some checks are pending
Check syntax / check (push) Waiting to run
Some checks are pending
Check syntax / check (push) Waiting to run
This commit is contained in:
parent
a89a10705c
commit
e0df590c76
1 changed files with 17 additions and 15 deletions
32
server.py
32
server.py
|
@ -612,21 +612,7 @@ def cleanup_manual():
|
||||||
nickname_list[k].sendall(f":{h}!~DISCONNECTED@DISCONNECTED PART {j} :IRCat Cleanup: Found missing connection!!\r\n")
|
nickname_list[k].sendall(f":{h}!~DISCONNECTED@DISCONNECTED PART {j} :IRCat Cleanup: Found missing connection!!\r\n")
|
||||||
|
|
||||||
def tcp_session(sock):
|
def tcp_session(sock):
|
||||||
try:
|
while True:
|
||||||
while opened:
|
|
||||||
print("Waiting for connection...")
|
|
||||||
connection, client = sock.accept()
|
|
||||||
ip_to = restrict_ip
|
|
||||||
threading.Thread(target=session, daemon=True, args=[connection, client, ip_to]).start()
|
|
||||||
except:
|
|
||||||
print("Shutting down...")
|
|
||||||
time.sleep(2)
|
|
||||||
sock.shutdown(1)
|
|
||||||
sock.close()
|
|
||||||
print("Something went wrong...")
|
|
||||||
print(traceback.format_exc())
|
|
||||||
def ssl_session(sock2):
|
|
||||||
with context.wrap_socket(sock2, server_side=True) as sock:
|
|
||||||
try:
|
try:
|
||||||
while opened:
|
while opened:
|
||||||
print("Waiting for connection...")
|
print("Waiting for connection...")
|
||||||
|
@ -640,6 +626,22 @@ def ssl_session(sock2):
|
||||||
sock.close()
|
sock.close()
|
||||||
print("Something went wrong...")
|
print("Something went wrong...")
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
|
def ssl_session(sock2):
|
||||||
|
with context.wrap_socket(sock2, server_side=True) as sock:
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
while opened:
|
||||||
|
print("Waiting for connection...")
|
||||||
|
connection, client = sock.accept()
|
||||||
|
ip_to = restrict_ip
|
||||||
|
threading.Thread(target=session, daemon=True, args=[connection, client, ip_to]).start()
|
||||||
|
except:
|
||||||
|
print("Shutting down...")
|
||||||
|
time.sleep(2)
|
||||||
|
sock.shutdown(1)
|
||||||
|
sock.close()
|
||||||
|
print("Something went wrong...")
|
||||||
|
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]).start()
|
threading.Thread(target=tcp_session, args=[i]).start()
|
||||||
|
|
Loading…
Reference in a new issue