From: Ben Pfaff Date: Wed, 13 Aug 2008 18:30:31 +0000 (-0700) Subject: rconn: Wake up immediately if we drain the send queue. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bff3b7f01b2fde6d2083d9fb71beddb46323c8c;p=openvswitch rconn: Wake up immediately if we drain the send queue. It is possible that some task is waiting for space to open up in the send queue, so we need to give it a chance to run. --- diff --git a/lib/rconn.c b/lib/rconn.c index da3ffb67..671a584d 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -310,12 +310,18 @@ run_CONNECTING(struct rconn *rc) static void do_tx_work(struct rconn *rc) { + if (!rc->txq.n) { + return; + } while (rc->txq.n > 0) { int error = try_send(rc); if (error) { break; } } + if (!rc->txq.n) { + poll_immediate_wake(); + } } static unsigned int @@ -618,6 +624,9 @@ disconnect(struct rconn *rc, int error) static void flush_queue(struct rconn *rc) { + if (!rc->txq.n) { + return; + } while (rc->txq.n > 0) { struct buffer *b = queue_pop_head(&rc->txq); int *n_queued = b->private; @@ -626,6 +635,7 @@ flush_queue(struct rconn *rc) } buffer_delete(b); } + poll_immediate_wake(); } static unsigned int