ovs.poller: workaround a bug in eventlet

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
YAMAMOTO Takashi 2013-04-25 16:05:51 +09:00 committed by FUJITA Tomonori
parent 507d11d00b
commit b103538674

View File

@ -18,6 +18,15 @@ import ovs.vlog
import select
import socket
try:
import eventlet.patcher
def _using_eventlet_green_select():
return eventlet.patcher.is_monkey_patched(select)
except:
def _using_eventlet_green_select():
return False
vlog = ovs.vlog.Vlog("poller")
POLLIN = 0x001
@ -59,6 +68,10 @@ class _SelectSelect(object):
timeout = None
else:
timeout = float(timeout) / 1000
# XXX workaround a bug in eventlet
# see https://github.com/eventlet/eventlet/pull/25
if timeout == 0 and _using_eventlet_green_select():
timeout = 0.1
rlist, wlist, xlist = select.select(self.rlist, self.wlist, self.xlist,
timeout)