Commit 0fd3769e authored by Alexandre Boeglin's avatar Alexandre Boeglin

replace urllib by socket, as urllib ignores the no_proxy environment variable,

and we don't want to go through the proxy here (as we just want to check
availability of a server running on the same machine, same processus,
different thread)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13516 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5c101296
......@@ -6,7 +6,7 @@ __version__ = 'TimerServer for Zope 0.1'
import traceback
import thread
import sys, os, errno, time, socket, urllib
import sys, os, errno, time, socket
from StringIO import StringIO
from zLOG import LOG, INFO
......@@ -55,12 +55,15 @@ class TimerServer:
# To be very sure, try to connect to the HTTPServer
# and only start after we are able to connect
while 1:
time.sleep(5)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(5)
try:
urllib.urlopen('http://%s:%s' %(ip, port))
except IOError:
s.connect((ip, port))
except (socket.error, socket.timeout):
s.close()
continue
break
s.close()
module = self.module
interval = self.interval
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment