Permalink
Browse files

Fix timeout code

  • Loading branch information...
1 parent 9937e6b commit 0ac4aade6bdc3e7724b4d704ded05d46da2a92f9 @jgoerzen jgoerzen committed Sep 11, 2006
Showing with 4 additions and 4 deletions.
  1. +4 −4 pygopherd/initialization.py
@@ -21,7 +21,7 @@
# Import lots of stuff so it's here before chrooting.
import socket, os, sys, SocketServer, re, stat, os.path, UserDict, tempfile
-import time, atexit, errno
+import time, atexit, errno, struct
from pygopherd import handlers, protocols, GopherExceptions, logger, sighandlers
from pygopherd.protocols import *
@@ -105,11 +105,11 @@ def server_bind(self):
# Set a timeout.
if config.has_option('pygopherd', 'timeout'):
- mytimeout = int(config.get('pygopherd', 'timeout'))
+ mytimeout = struct.pack("ll", long(config.get('pygopherd', 'timeout')), 0)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_RCVTIMEO,
- (mytimeout, 0))
+ mytimeout)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_SNDTIMEO,
- (mytimeout, 0))
+ mytimeout)
#self.socket.settimeout(int(config.get('pygopherd', 'timeout')))
host, port = self.socket.getsockname()
if config.has_option("pygopherd", "servername"):

0 comments on commit 0ac4aad

Please sign in to comment.