From ff05c2dd57b21b719979bc20a96c9be98f9869cc Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 16 May 2014 12:52:05 -0400 Subject: [PATCH] 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 --- pyghmi/ipmi/private/session.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 0ec38434..934158d6 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -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):