Browse Source

Fixes 'settimeout()' problem introduced with commit efcba2c2e.

Configuring a timed blocking behaviour on the listening socket, such that
any derived sockets will have the same blocking behaviour, did not consider
that the listening socket will timeout in 'accept()' as well. Hence, 'set-
timeout()' should only be called on derived sockets after accept to obey
the desired behaviour during the 'recv()' operation.

Signed-off-by: Stefan Laudemann <thisco@zitmail.uni-paderborn.de>
Stefan Laudemann 9 years ago
parent
commit
6253701ccf
1 changed files with 1 additions and 1 deletions
  1. 1 1
      server.py

+ 1 - 1
server.py

@@ -18,13 +18,13 @@ def serve(port, bindTo, path_report_store=None):
 	assert path_report_store != None
 
 	s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
-	s.settimeout(30.0)
 	s.bind((bindTo, port))
 	s.listen(1)
 	print('DebugReport server listening on [{0}]:{1}'.format(bindTo, port))
 
 	while 1:
 		conn, addr = s.accept()
+		conn.settimeout(30.0)
 
 		report_id = myrandom(10)
 		filename = os.path.join(