From: Ondrej Lichtner olichtne@redhat.com
This patch extends the ConnectionHandler class with functionality to check specific connections for new messages instead of always checking all of them.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Common/ConnectionHandler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lnst/Common/ConnectionHandler.py b/lnst/Common/ConnectionHandler.py index 042e78a..e8a6976 100644 --- a/lnst/Common/ConnectionHandler.py +++ b/lnst/Common/ConnectionHandler.py @@ -70,9 +70,15 @@ class ConnectionHandler(object): self._connections = {}
def check_connections(self): + return self.check_connections_by_id(self._connections.keys()) + + def check_connections_by_id(self, connection_ids): + connections = [] + for con_id in connection_ids: + connections.append(self._connections[con_id]) requests = [] try: - rl, wl, xl = select.select(self._connections.values(), [], [], 0) + rl, wl, xl = select.select(connections, [], [], 0) except select.error: return [] for f in rl: