def recv(self, *args):
sock = self._sock # keeping the reference so that fd is not closed during waiting
while True:
try:
return sock.recv(*args)
except error, ex:
if ex[0] == EBADF:
return ''
if ex[0] != EWOULDBLOCK or self.timeout == 0.0:
raise
# QQQ without clearing exc_info test__refcount.test_clean_exit fails
sys.exc_clear()
try:
wait_read(sock.fileno(), timeout=self.timeout, event=self._read_event)
except error, ex:
if ex[0] == EBADF:
return ''
raise
评论列表
文章目录