mirror of
https://opendev.org/x/pyghmi
synced 2025-03-19 09:57:43 +00:00
Change long timeout to select() from poll()
Change from poll() to select() for the potentially long wait in ipmi event loop. This is to facilitate interop with being monkey patched with eventlet, as eventlet does not currently monkey patch poll(), but does monkey patch select() Change-Id: I8d6f42193ee82e2c5de7ad112232c2c77ef78825
This commit is contained in:
parent
7371a58aba
commit
c0f4959ed7
@ -165,6 +165,7 @@ class Session:
|
||||
|
||||
curmax = cls.socket.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF)
|
||||
cls.poller.register(cls.socket, select.POLLIN)
|
||||
cls.readersockets = [cls.socket]
|
||||
cls.ipmipoller.register(cls.socket, select.POLLIN)
|
||||
curmax = curmax / 2
|
||||
# we throttle such that we never have no more outstanding packets than
|
||||
@ -637,7 +638,8 @@ class Session:
|
||||
# could be waiting so we can always return 0
|
||||
if timeout is None:
|
||||
return 0
|
||||
if cls.poller.poll(timeout * 1000):
|
||||
rdylist, _, _ = select.select(cls.readersockets, (), (), timeout)
|
||||
if len(rdylist) > 0:
|
||||
while cls.ipmipoller.poll(0): # if the somewhat lengthy queue
|
||||
# processing takes long enough for packets to come in,
|
||||
# be eager
|
||||
@ -698,6 +700,7 @@ class Session:
|
||||
will receive the handle as an argument
|
||||
"""
|
||||
cls._external_handlers[handle.fileno()] = (callback, handle)
|
||||
cls.readersockets += [handle]
|
||||
cls.poller.register(handle, select.POLLIN)
|
||||
|
||||
@classmethod
|
||||
|
Loading…
x
Reference in New Issue
Block a user