reconnect uses the same connection state names as rconn with the exception of
the above. This commit makes their states identical, which should reduce
confusion for people debugging connection problems.
---
 lib/reconnect.c         |   16 ++++++------
 python/ovs/reconnect.py |    2 +-
 tests/reconnect.at      |   64 +++++++++++++++++++++++-----------------------
 3 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/lib/reconnect.c b/lib/reconnect.c
index 08ce858..f8463bb 100644
--- a/lib/reconnect.c
+++ b/lib/reconnect.c
@@ -28,7 +28,7 @@ VLOG_DEFINE_THIS_MODULE(reconnect);
 #define STATES                                  \
     STATE(VOID, 1 << 0)                         \
     STATE(BACKOFF, 1 << 1)                      \
-    STATE(CONNECT_IN_PROGRESS, 1 << 3)          \
+    STATE(CONNECTING, 1 << 3)          \
     STATE(ACTIVE, 1 << 4)                       \
     STATE(IDLE, 1 << 5)                         \
     STATE(RECONNECT, 1 << 6)                    \
@@ -263,7 +263,7 @@ reconnect_set_passive(struct reconnect *fsm, bool passive, 
long long int now)
         fsm->passive = passive;
 
         if (passive
-            ? fsm->state & (S_CONNECT_IN_PROGRESS | S_RECONNECT)
+            ? fsm->state & (S_CONNECTING | S_RECONNECT)
             : fsm->state == S_LISTENING && reconnect_may_retry(fsm)) {
             reconnect_transition__(fsm, now, S_BACKOFF);
             fsm->backoff = 0;
@@ -312,7 +312,7 @@ reconnect_disable(struct reconnect *fsm, long long int now)
 void
 reconnect_force_reconnect(struct reconnect *fsm, long long int now)
 {
-    if (fsm->state & (S_CONNECT_IN_PROGRESS | S_ACTIVE | S_IDLE)) {
+    if (fsm->state & (S_CONNECTING | S_ACTIVE | S_IDLE)) {
         reconnect_transition__(fsm, now, S_RECONNECT);
     }
 }
@@ -393,13 +393,13 @@ reconnect_disconnected(struct reconnect *fsm, long long 
int now, int error)
 void
 reconnect_connecting(struct reconnect *fsm, long long int now)
 {
-    if (fsm->state != S_CONNECT_IN_PROGRESS) {
+    if (fsm->state != S_CONNECTING) {
         if (fsm->passive) {
             VLOG(fsm->info, "%s: listening...", fsm->name);
         } else {
             VLOG(fsm->info, "%s: connecting...", fsm->name);
         }
-        reconnect_transition__(fsm, now, S_CONNECT_IN_PROGRESS);
+        reconnect_transition__(fsm, now, S_CONNECTING);
     }
 }
 
@@ -482,7 +482,7 @@ static void
 reconnect_transition__(struct reconnect *fsm, long long int now,
                        enum state state)
 {
-    if (fsm->state == S_CONNECT_IN_PROGRESS) {
+    if (fsm->state == S_CONNECTING) {
         fsm->n_attempted_connections++;
         if (state == S_ACTIVE) {
             fsm->n_successful_connections++;
@@ -512,7 +512,7 @@ reconnect_deadline__(const struct reconnect *fsm)
     case S_BACKOFF:
         return fsm->state_entered + fsm->backoff;
 
-    case S_CONNECT_IN_PROGRESS:
+    case S_CONNECTING:
         return fsm->state_entered + MAX(1000, fsm->backoff);
 
     case S_ACTIVE:
@@ -579,7 +579,7 @@ reconnect_run(struct reconnect *fsm, long long int now)
         case S_BACKOFF:
             return RECONNECT_CONNECT;
 
-        case S_CONNECT_IN_PROGRESS:
+        case S_CONNECTING:
             return RECONNECT_DISCONNECT;
 
         case S_ACTIVE:
diff --git a/python/ovs/reconnect.py b/python/ovs/reconnect.py
index 3a71188..3445245 100644
--- a/python/ovs/reconnect.py
+++ b/python/ovs/reconnect.py
@@ -72,7 +72,7 @@ class Reconnect(object):
             return CONNECT
 
     class ConnectInProgress(object):
-        name = "CONNECT_IN_PROGRESS"
+        name = "CONNECTING"
         is_connected = False
 
         @staticmethod
diff --git a/tests/reconnect.at b/tests/reconnect.at
index 171c35c..6a9ae1e 100644
--- a/tests/reconnect.at
+++ b/tests/reconnect.at
@@ -119,13 +119,13 @@ enable
 run
   should connect
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (0 ms backoff)
+  in CONNECTING for 0 ms (0 ms backoff)
 
 # Connect after 500 ms.
 advance 500
 
 ### t=1500 ###
-  in CONNECT_IN_PROGRESS for 500 ms (0 ms backoff)
+  in CONNECTING for 500 ms (0 ms backoff)
   disconnected for 500 ms
 run
 connected
@@ -232,13 +232,13 @@ enable
 run
   should connect
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (0 ms backoff)
+  in CONNECTING for 0 ms (0 ms backoff)
 run
 timeout
   advance 1000 ms
 
 ### t=2000 ###
-  in CONNECT_IN_PROGRESS for 1000 ms (0 ms backoff)
+  in CONNECTING for 1000 ms (0 ms backoff)
   disconnected for 1000 ms
 run
   should disconnect
@@ -258,12 +258,12 @@ run
 
 # Second connection attempt fails after 1000 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (1000 ms backoff)
+  in CONNECTING for 0 ms (1000 ms backoff)
 timeout
   advance 1000 ms
 
 ### t=4000 ###
-  in CONNECT_IN_PROGRESS for 1000 ms (1000 ms backoff)
+  in CONNECTING for 1000 ms (1000 ms backoff)
   disconnected for 3000 ms
 run
   should disconnect
@@ -283,12 +283,12 @@ run
 
 # Third connection attempt fails after 2000 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (2000 ms backoff)
+  in CONNECTING for 0 ms (2000 ms backoff)
 timeout
   advance 2000 ms
 
 ### t=8000 ###
-  in CONNECT_IN_PROGRESS for 2000 ms (2000 ms backoff)
+  in CONNECTING for 2000 ms (2000 ms backoff)
   disconnected for 7000 ms
 run
   should disconnect
@@ -308,12 +308,12 @@ run
 
 # Third connection attempt fails after 4000 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (4000 ms backoff)
+  in CONNECTING for 0 ms (4000 ms backoff)
 timeout
   advance 4000 ms
 
 ### t=16000 ###
-  in CONNECT_IN_PROGRESS for 4000 ms (4000 ms backoff)
+  in CONNECTING for 4000 ms (4000 ms backoff)
   disconnected for 15000 ms
 run
   should disconnect
@@ -333,12 +333,12 @@ run
 
 # Third connection attempt fails after 8000 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (8000 ms backoff)
+  in CONNECTING for 0 ms (8000 ms backoff)
 timeout
   advance 8000 ms
 
 ### t=32000 ###
-  in CONNECT_IN_PROGRESS for 8000 ms (8000 ms backoff)
+  in CONNECTING for 8000 ms (8000 ms backoff)
   disconnected for 31000 ms
 run
   should disconnect
@@ -358,12 +358,12 @@ run
 
 # Fourth connection attempt fails after 8000 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (8000 ms backoff)
+  in CONNECTING for 0 ms (8000 ms backoff)
 timeout
   advance 8000 ms
 
 ### t=48000 ###
-  in CONNECT_IN_PROGRESS for 8000 ms (8000 ms backoff)
+  in CONNECTING for 8000 ms (8000 ms backoff)
   disconnected for 47000 ms
 run
   should disconnect
@@ -588,13 +588,13 @@ enable
 run
   should connect
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (0 ms backoff)
+  in CONNECTING for 0 ms (0 ms backoff)
 run
 timeout
   advance 1000 ms
 
 ### t=2000 ###
-  in CONNECT_IN_PROGRESS for 1000 ms (0 ms backoff)
+  in CONNECTING for 1000 ms (0 ms backoff)
   disconnected for 1000 ms
 run
   should disconnect
@@ -614,12 +614,12 @@ run
 
 # Second connection attempt fails after 1000 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (1000 ms backoff)
+  in CONNECTING for 0 ms (1000 ms backoff)
 timeout
   advance 1000 ms
 
 ### t=4000 ###
-  in CONNECT_IN_PROGRESS for 1000 ms (1000 ms backoff)
+  in CONNECTING for 1000 ms (1000 ms backoff)
   disconnected for 3000 ms
 run
   should disconnect
@@ -639,11 +639,11 @@ run
 
 # Third connection attempt succeeds after 500 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (2000 ms backoff)
+  in CONNECTING for 0 ms (2000 ms backoff)
 advance 500
 
 ### t=6500 ###
-  in CONNECT_IN_PROGRESS for 500 ms (2000 ms backoff)
+  in CONNECTING for 500 ms (2000 ms backoff)
   disconnected for 5500 ms
 run
 connected
@@ -736,13 +736,13 @@ enable
 run
   should connect
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (0 ms backoff)
+  in CONNECTING for 0 ms (0 ms backoff)
 run
 timeout
   advance 1000 ms
 
 ### t=2000 ###
-  in CONNECT_IN_PROGRESS for 1000 ms (0 ms backoff)
+  in CONNECTING for 1000 ms (0 ms backoff)
   disconnected for 1000 ms
 run
   should disconnect
@@ -762,12 +762,12 @@ run
 
 # Second connection attempt fails after 1000 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (1000 ms backoff)
+  in CONNECTING for 0 ms (1000 ms backoff)
 timeout
   advance 1000 ms
 
 ### t=4000 ###
-  in CONNECT_IN_PROGRESS for 1000 ms (1000 ms backoff)
+  in CONNECTING for 1000 ms (1000 ms backoff)
   disconnected for 3000 ms
 run
   should disconnect
@@ -787,11 +787,11 @@ run
 
 # Third connection attempt succeeds after 500 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (2000 ms backoff)
+  in CONNECTING for 0 ms (2000 ms backoff)
 advance 500
 
 ### t=6500 ###
-  in CONNECT_IN_PROGRESS for 500 ms (2000 ms backoff)
+  in CONNECTING for 500 ms (2000 ms backoff)
   disconnected for 5500 ms
 run
 connected
@@ -905,13 +905,13 @@ enable
 run
   should connect
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (0 ms backoff)
+  in CONNECTING for 0 ms (0 ms backoff)
 run
 timeout
   advance 1000 ms
 
 ### t=2000 ###
-  in CONNECT_IN_PROGRESS for 1000 ms (0 ms backoff)
+  in CONNECTING for 1000 ms (0 ms backoff)
   disconnected for 1000 ms
 run
   should disconnect
@@ -931,12 +931,12 @@ run
 
 # Second connection attempt fails after 1000 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (1000 ms backoff)
+  in CONNECTING for 0 ms (1000 ms backoff)
 timeout
   advance 1000 ms
 
 ### t=4000 ###
-  in CONNECT_IN_PROGRESS for 1000 ms (1000 ms backoff)
+  in CONNECTING for 1000 ms (1000 ms backoff)
   disconnected for 3000 ms
 run
   should disconnect
@@ -956,11 +956,11 @@ run
 
 # Third connection attempt succeeds after 500 ms.
 connecting
-  in CONNECT_IN_PROGRESS for 0 ms (2000 ms backoff)
+  in CONNECTING for 0 ms (2000 ms backoff)
 advance 500
 
 ### t=6500 ###
-  in CONNECT_IN_PROGRESS for 500 ms (2000 ms backoff)
+  in CONNECTING for 500 ms (2000 ms backoff)
   disconnected for 5500 ms
 run
 connected
-- 
1.7.2.3

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to