[Zope-Checkins] CVS: Zope/ZServer/medusa - asyncore.py:1.17
Brian Lloyd
brian@zope.com
Mon, 21 Jan 2002 10:00:16 -0500
Update of /cvs-repository/Zope/ZServer/medusa
In directory cvs.zope.org:/tmp/cvs-serv16251
Modified Files:
asyncore.py
Log Message:
Added fix for collector #157: hang on linux 2.2.
=== Zope/ZServer/medusa/asyncore.py 1.16 => 1.17 ===
import os
from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \
- ENOTCONN, ESHUTDOWN, EINTR, EISCONN
+ ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EAGAIN
try:
socket_map
@@ -521,7 +521,15 @@
self.fd = fd
def recv (self, *args):
- return apply (os.read, (self.fd,)+args)
+ # NOTE: this is a difference from the Python 2.2 library
+ # version of asyncore.py. This prevents a hanging condition
+ # on Linux 2.2 based systems.
+ while 1:
+ try:
+ return apply (os.read, (self.fd,)+args)
+ except exceptions.OSError, why:
+ if why[0] != EAGAIN:
+ raise
def send (self, *args):
return apply (os.write, (self.fd,)+args)