If ovs-vswitchd or ovsdb-server is trying to connect to a controller
over SSL that isn't up yet, and the connection is set to bootstrap
the CA cert, the following annoying thing happens: - The connection
will go into backoff mode, where it is only trying to connect once
every 8 seconds. - Once it connects and downloads the CA cert,
it immediately disconnects. - Because it's still in backoff mode,
it waits another 8 seconds to re-establish the connection
using the new CA cert.

This fix helps to immediately re-connect without having to wait
for a backoff period.

Bug #1180819

Signed-off-by: Arun Sharma <arun.sha...@calsoftinc.com>
---
 lib/rconn.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/rconn.c b/lib/rconn.c
index e24c356..2b88601 100644
--- a/lib/rconn.c
+++ b/lib/rconn.c
@@ -1197,7 +1197,6 @@ static void
 disconnect(struct rconn *rc, int error)
     OVS_REQUIRES(rc->mutex)
 {
-    rc->last_error = error;
     if (rc->vconn) {
         vconn_close(rc->vconn);
         rc->vconn = NULL;
@@ -1210,7 +1209,10 @@ disconnect(struct rconn *rc, int error)
             flush_queue(rc);
         }
 
-        if (now >= rc->backoff_deadline) {
+        if(rc->last_error == ECONNREFUSED && error == EPROTO) {
+            rc->backoff = 0;
+            VLOG_INFO("Disconnecting to retry using bootstrapped certificate");
+        } else if (now >= rc->backoff_deadline) {
             rc->backoff = 1;
         } else if (rc->backoff < rc->max_backoff / 2) {
             rc->backoff = MAX(1, 2 * rc->backoff);
@@ -1224,6 +1226,8 @@ disconnect(struct rconn *rc, int error)
             }
             rc->backoff = rc->max_backoff;
         }
+
+        rc->last_error = error;
         rc->backoff_deadline = now + rc->backoff;
         state_transition(rc, S_BACKOFF);
     } else {
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to