rconn: Queue packets for tx only if connected.
authorBen Pfaff <blp@nicira.com>
Wed, 13 Aug 2008 18:21:49 +0000 (11:21 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 13 Aug 2008 18:21:49 +0000 (11:21 -0700)
Until now, the rconn code would queue up packets not just while connected
but also while connecting.  This is not just unnecessary, however, it
actually causes a problem in secchan: if the secchan receives packets
from nl:0 and tries to transmit them, then they will quickly fill up
the rconn's transmit buffer (it uses a 1-packet buffer), which causes
secchan to stop reading packets from nl:0 until the buffer frees up.
That cannot happen until the connection completes.  With in-band control,
however, the connection cannot complete until we receive and process
packet_in messages in our in-band hook.  Thus, we have a deadlock.

Fixes bug #90, "Sometimes secchan has to go into fail-open mode to connect."

lib/rconn.c

index 6bc371a..a4ff91a 100644 (file)
@@ -446,7 +446,7 @@ rconn_recv_wait(struct rconn *rc)
 int
 rconn_send(struct rconn *rc, struct buffer *b, int *n_queued)
 {
-    if (rc->vconn) {
+    if (rconn_is_connected(rc)) {
         b->private = n_queued;
         if (n_queued) {
             ++*n_queued;