Skip to content
Browse files

First attempt at setting socket timeouts

  • Loading branch information...
1 parent 6d50bd2 commit 30552ee9941a29d33a1987ef53f8e921ace71ddb @jgoerzen jgoerzen committed Sep 11, 2006
Showing with 9 additions and 0 deletions.
  1. +9 −0 pygopherd/initialization.py
View
9 pygopherd/initialization.py
@@ -102,6 +102,15 @@ class MyServer(servertype):
def server_bind(self):
"""Override server_bind to store server name."""
servertype.server_bind(self)
+
+ # Set a timeout.
+ if config.has_option('pygopherd', 'timeout'):
+ mytimeout = int(config.get('pygopherd', 'timeout'))
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_RCVTIMEO,
+ (mytimeout, 0))
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_SNDTIMEO,
+ (mytimeout, 0))
+ #self.socket.settimeout(int(config.get('pygopherd', 'timeout')))
host, port = self.socket.getsockname()
if config.has_option("pygopherd", "servername"):
self.server_name = config.get("pygopherd", "servername")

0 comments on commit 30552ee

Please sign in to comment.
Something went wrong with that request. Please try again.