Skip to content

Commit 59c646e

Browse files
committed
minor tidy
1 parent 63d1bd5 commit 59c646e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

NATServer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from socketserver import UDPServer,DatagramRequestHandler
2-
import sys
2+
import sys, logging
33

44
class CustomUDPServer(UDPServer):
55
def Bind(self, root):
@@ -35,7 +35,7 @@ def handle(self):
3535
class NATServer:
3636
def __init__(self, port):
3737
self.s = CustomUDPServer(('',port), handler)
38-
print("Awaiting UDP messages on port %d" % port)
38+
logging.info("Awaiting UDP messages on port %d" % port)
3939

4040
def bind(self, root):
4141
self.s.Bind(root)

server.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ def sighup(sig, frame):
3535

3636
logging.info('Starting uberserver...')
3737

38-
natport = _root.natport
39-
backlog = 100
40-
4138
try:
39+
natport = _root.natport
4240
natserver = NATServer(natport)
4341
thread.start_new_thread(natserver.start,())
4442
natserver.bind(_root)
4543
except socket.error:
46-
print('Error: Could not start NAT server - hole punching will be unavailable.')
44+
logging.error("Could not start NAT server - hole punching will be unavailable.")
4745

4846
_root.init()
4947

@@ -71,7 +69,7 @@ def sighup(sig, frame):
7169
logging.info('Server killed by keyboard interrupt.')
7270
except:
7371
logging.error(traceback.format_exc())
74-
logging.info('Deep error, exiting...')
72+
logging.info('Exception caught, exiting...')
7573

7674
_root.shutdown()
7775

0 commit comments

Comments
 (0)