2
0
mirror of https://opendev.org/x/pyghmi synced 2025-09-08 19:28:09 +00:00

Correct ignoring socket when inappropriate

When fixing the performance by declining to select() on a socket
until a recvfrom() explictly occurs to clear the socket, a problem
was injected where a socket could be made ignored by particular
timing of incoming traffic on the socket.  Correct this by having
the _poller function forcefully return True if any sockets
are ignored (which also implies they are ready since they
should be discarded on read).

Change-Id: I6be39d39e4d2ed3b05af9a4c954fb64c993ffb50
This commit is contained in:
Jarrod Johnson
2014-05-16 12:52:05 -04:00
parent 61c3bfd867
commit ff05c2dd57

View File

@@ -164,8 +164,9 @@ def _monotonic_time():
def _poller(timeout=0):
rdylist = _io_apply('wait', timeout + _monotonic_time())
return rdylist
if ignoresockets:
return True
return _io_apply('wait', timeout + _monotonic_time())
def _aespad(data):
@@ -905,8 +906,7 @@ class Session(object):
timeout = 0
if timeout is None:
return 0
rdylist = _poller(timeout=timeout)
if len(rdylist) > 0:
if _poller(timeout=timeout):
pktqueue = collections.deque([])
cls.pulltoqueue(iosockets, pktqueue)
while len(pktqueue):