[Erp5-report] r13516 - /erp5/trunk/products/TimerService/timerserver/TimerServer.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Mar 20 11:26:03 CET 2007
Author: alex
Date: Tue Mar 20 11:26:02 2007
New Revision: 13516
URL: http://svn.erp5.org?rev=13516&view=rev
Log:
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)
Modified:
erp5/trunk/products/TimerService/timerserver/TimerServer.py
Modified: erp5/trunk/products/TimerService/timerserver/TimerServer.py
URL: http://svn.erp5.org/erp5/trunk/products/TimerService/timerserver/TimerServer.py?rev=13516&r1=13515&r2=13516&view=diff
==============================================================================
--- erp5/trunk/products/TimerService/timerserver/TimerServer.py (original)
+++ erp5/trunk/products/TimerService/timerserver/TimerServer.py Tue Mar 20 11:26:02 2007
@@ -6,7 +6,7 @@
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 @@
# 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
More information about the Erp5-report
mailing list