client/tools/osad/src/osa_dispatcher.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit c55818af8d22109b7e9d1310d694cae1561e0e41
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Tue Apr 10 15:34:16 2012 +0200
716064 - prevent 'notifying clients' starvation
Previously, in a single loop pass, we only notified clients if there
was no more data to read from clients:
if (there_is_client_data_to_read):
read_the_client_data()
else:
push_scheduled_actions_to_clients()
This schema would allow for starvation of the else branch. All you
needed for the starvation was a data to be read from clients, since
it would always be prefered to the event pushing.
We want to prevent the starvation using the following logic:
if (there_is_client_data_to_read):
read_the_client_data()
if (the_client_socket_is_write_ready):
push_scheduled_actions_to_clients()
diff --git a/client/tools/osad/src/osa_dispatcher.py
b/client/tools/osad/src/osa_dispatcher.py
index 2071672..a5a1e6c 100644
--- a/client/tools/osad/src/osa_dispatcher.py
+++ b/client/tools/osad/src/osa_dispatcher.py
@@ -187,7 +187,7 @@ class Runner(jabber_lib.Runner):
client.ping_clients(need_pinging)
npi = self._next_poll_interval
- rfds, wfds, efds = select.select([client, self._tcp_server], [], [], npi)
+ rfds, wfds, efds = select.select([client, self._tcp_server], [client], [], npi)
# Reset the next poll interval
npi = self._next_poll_interval = self._poll_interval
if client in rfds:
@@ -198,7 +198,7 @@ class Runner(jabber_lib.Runner):
# we were tickled
self._tcp_server.handle_request()
npi = self._tcp_server.get_next_poll_interval() or self._poll_interval
- if not rfds:
+ if wfds:
# Timeout
log_debug(5,"Notifying jabber nodes")
self._tcp_server.notify_jabber_nodes()
Show replies by date