summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPratyush Desai2023-07-22 02:25:25 +0530
committerPratyush Desai2023-07-22 02:25:25 +0530
commit8a3800549c9e293ec8bf3af1459c21deee7e8119 (patch)
treeb2e1098ebaf46f8171af322dd90a6ca197c44437
parent19bcae4b1a639537f447460df76219459f33caaa (diff)
downloadsyncplay-flake8.tar.gz
syncplay-flake8.tar.bz2
syncplay-flake8.zip
flake8tedflake8
Signed-off-by: Pratyush Desai <pratyush.desai@liberta.casa>
-rwxr-xr-xsyncplay-proxy/syncplay-proxy10
1 files changed, 7 insertions, 3 deletions
diff --git a/syncplay-proxy/syncplay-proxy b/syncplay-proxy/syncplay-proxy
index 5ed7a4e..a5f0b4b 100755
--- a/syncplay-proxy/syncplay-proxy
+++ b/syncplay-proxy/syncplay-proxy
@@ -14,6 +14,7 @@ import sys
listen_port = int(sys.argv[1])
forward_port = int(sys.argv[2])
+
class SyncplayRequestHandler(socketserver.BaseRequestHandler):
def handle(self):
print('Handling connection from:', self.client_address)
@@ -22,7 +23,7 @@ class SyncplayRequestHandler(socketserver.BaseRequestHandler):
print('Bad connection header from:', self.client_address)
try:
self.request.close()
- except:
+ except Exception as e:
pass
return
print('Opening forwarding connection on behalf of:', self.client_address)
@@ -45,18 +46,21 @@ class SyncplayRequestHandler(socketserver.BaseRequestHandler):
print('Proxying stopped for:', self.client_address)
try:
forwarded_conn.close()
- except:
+ except Exception as e:
pass
try:
self.request.close()
- except:
+ except Exception as e:
pass
+
class SyncplayServer(socketserver.ThreadingTCPServer):
address_family = socket.AF_INET6
+
def server_bind(self):
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
socketserver.ThreadingTCPServer.server_bind(self)
+
with SyncplayServer(('', listen_port), SyncplayRequestHandler) as server:
server.serve_forever()