[Zope-Checkins] CVS: Zope2 - select_trigger.py:1.4
andreas@serenade.digicool.com
andreas@serenade.digicool.com
Tue, 1 May 2001 08:03:21 -0400
Update of /cvs-repository/Zope2/ZServer/medusa/thread
In directory serenade.digicool.com:/tmp/cvs-serv12487/thread
Modified Files:
select_trigger.py
Log Message:
backport of former medusa patches
--- Updated File select_trigger.py in package Zope2 --
--- select_trigger.py 2001/05/01 11:45:27 1.3
+++ select_trigger.py 2001/05/01 12:03:20 1.4
@@ -89,8 +89,9 @@
else:
- # win32-safe version
+ # win32-safe version
+
class trigger (asyncore.dispatcher):
address = ('127.9.9.9', 19999)
@@ -99,8 +100,22 @@
a = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
w = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
+ # set TCP_NODELAY to true to avoid buffering
+ w.setsockopt(socket.IPPROTO_TCP, 1, 1)
+
# tricky: get a pair of connected sockets
- a.bind (self.address)
+ host='127.0.0.1'
+ port=19999
+ while 1:
+ try:
+ self.address=(host, port)
+ a.bind(self.address)
+ break
+ except:
+ if port <= 19950:
+ raise 'Bind Error', 'Cannot bind trigger!'
+ port=port - 1
+
a.listen (1)
w.setblocking (0)
try: