2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

reconnect: Rename reconnect_received() to reconnect_activity().

Receiving data is not the only reasonable way to verify that a connection
is up.  For example, on a TCP connection, receiving an acknowledgment that
the remote side has accepted data that we sent is also a reasonable means.
Therefore, this commit generalizes the naming.

Also, similarly for the Python implementation: Reconnect.received() becomes
Reconnect.activity().

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2012-08-08 13:32:57 -07:00
parent e0f3585d44
commit a6f639f808
8 changed files with 84 additions and 83 deletions

View File

@@ -977,7 +977,7 @@ jsonrpc_session_recv(struct jsonrpc_session *s)
struct jsonrpc_msg *msg; struct jsonrpc_msg *msg;
jsonrpc_recv(s->rpc, &msg); jsonrpc_recv(s->rpc, &msg);
if (msg) { if (msg) {
reconnect_received(s->reconnect, time_msec()); reconnect_activity(s->reconnect, time_msec());
if (msg->type == JSONRPC_REQUEST && !strcmp(msg->method, "echo")) { if (msg->type == JSONRPC_REQUEST && !strcmp(msg->method, "echo")) {
/* Echo request. Send reply. */ /* Echo request. Send reply. */
struct jsonrpc_msg *reply; struct jsonrpc_msg *reply;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008, 2009, 2010 Nicira, Inc. * Copyright (c) 2008, 2009, 2010, 2012 Nicira, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ struct reconnect {
enum state state; enum state state;
long long int state_entered; long long int state_entered;
int backoff; int backoff;
long long int last_received; long long int last_activity;
long long int last_connected; long long int last_connected;
long long int last_disconnected; long long int last_disconnected;
unsigned int max_tries; unsigned int max_tries;
@@ -105,7 +105,7 @@ reconnect_create(long long int now)
fsm->state = S_VOID; fsm->state = S_VOID;
fsm->state_entered = now; fsm->state_entered = now;
fsm->backoff = 0; fsm->backoff = 0;
fsm->last_received = now; fsm->last_activity = now;
fsm->last_connected = LLONG_MAX; fsm->last_connected = LLONG_MAX;
fsm->last_disconnected = LLONG_MAX; fsm->last_disconnected = LLONG_MAX;
fsm->max_tries = UINT_MAX; fsm->max_tries = UINT_MAX;
@@ -176,9 +176,9 @@ reconnect_get_max_backoff(const struct reconnect *fsm)
/* Returns the "probe interval" for 'fsm' in milliseconds. If this is zero, it /* Returns the "probe interval" for 'fsm' in milliseconds. If this is zero, it
* disables the connection keepalive feature. If it is nonzero, then if the * disables the connection keepalive feature. If it is nonzero, then if the
* interval passes while 'fsm' is connected and without reconnect_received() * interval passes while 'fsm' is connected and without reconnect_activity()
* being called for 'fsm', reconnect_run() returns RECONNECT_PROBE. If the * being called for 'fsm', reconnect_run() returns RECONNECT_PROBE. If the
* interval passes again without reconnect_received() being called, * interval passes again without reconnect_activity() being called,
* reconnect_run() returns RECONNECT_DISCONNECT for 'fsm'. */ * reconnect_run() returns RECONNECT_DISCONNECT for 'fsm'. */
int int
reconnect_get_probe_interval(const struct reconnect *fsm) reconnect_get_probe_interval(const struct reconnect *fsm)
@@ -233,8 +233,8 @@ reconnect_set_backoff(struct reconnect *fsm, int min_backoff, int max_backoff)
/* Sets the "probe interval" for 'fsm' to 'probe_interval', in milliseconds. /* Sets the "probe interval" for 'fsm' to 'probe_interval', in milliseconds.
* If this is zero, it disables the connection keepalive feature. If it is * If this is zero, it disables the connection keepalive feature. If it is
* nonzero, then if the interval passes while 'fsm' is connected and without * nonzero, then if the interval passes while 'fsm' is connected and without
* reconnect_received() being called for 'fsm', reconnect_run() returns * reconnect_activity() being called for 'fsm', reconnect_run() returns
* RECONNECT_PROBE. If the interval passes again without reconnect_received() * RECONNECT_PROBE. If the interval passes again without reconnect_activity()
* being called, reconnect_run() returns RECONNECT_DISCONNECT for 'fsm'. * being called, reconnect_run() returns RECONNECT_DISCONNECT for 'fsm'.
* *
* If 'probe_interval' is nonzero, then it will be forced to a value of at * If 'probe_interval' is nonzero, then it will be forced to a value of at
@@ -360,7 +360,7 @@ reconnect_disconnected(struct reconnect *fsm, long long int now, int error)
} }
/* Back off. */ /* Back off. */
if (fsm->state & (S_ACTIVE | S_IDLE) if (fsm->state & (S_ACTIVE | S_IDLE)
&& (fsm->last_received - fsm->last_connected >= fsm->backoff && (fsm->last_activity - fsm->last_connected >= fsm->backoff
|| fsm->passive)) { || fsm->passive)) {
fsm->backoff = fsm->passive ? 0 : fsm->min_backoff; fsm->backoff = fsm->passive ? 0 : fsm->min_backoff;
} else { } else {
@@ -441,7 +441,7 @@ reconnect_listen_error(struct reconnect *fsm, long long int now, int error)
/* Tell 'fsm' that the connection was successful. /* Tell 'fsm' that the connection was successful.
* *
* The FSM will start the probe interval timer, which is reset by * The FSM will start the probe interval timer, which is reset by
* reconnect_received(). If the timer expires, a probe will be sent (by * reconnect_activity(). If the timer expires, a probe will be sent (by
* returning RECONNECT_PROBE from reconnect_run()). If the timer expires * returning RECONNECT_PROBE from reconnect_run()). If the timer expires
* again without being reset, the connection will be aborted (by returning * again without being reset, the connection will be aborted (by returning
* RECONNECT_DISCONNECT from reconnect_run()). */ * RECONNECT_DISCONNECT from reconnect_run()). */
@@ -467,15 +467,15 @@ reconnect_connect_failed(struct reconnect *fsm, long long int now, int error)
reconnect_disconnected(fsm, now, error); reconnect_disconnected(fsm, now, error);
} }
/* Tell 'fsm' that some data was received. This resets the probe interval /* Tell 'fsm' that some activity has occurred on the connection. This resets
* timer, so that the connection is known not to be idle. */ * the probe interval timer, so that the connection is known not to be idle. */
void void
reconnect_received(struct reconnect *fsm, long long int now) reconnect_activity(struct reconnect *fsm, long long int now)
{ {
if (fsm->state != S_ACTIVE) { if (fsm->state != S_ACTIVE) {
reconnect_transition__(fsm, now, S_ACTIVE); reconnect_transition__(fsm, now, S_ACTIVE);
} }
fsm->last_received = now; fsm->last_activity = now;
} }
static void static void
@@ -517,7 +517,7 @@ reconnect_deadline__(const struct reconnect *fsm)
case S_ACTIVE: case S_ACTIVE:
if (fsm->probe_interval) { if (fsm->probe_interval) {
long long int base = MAX(fsm->last_received, fsm->state_entered); long long int base = MAX(fsm->last_activity, fsm->state_entered);
return base + fsm->probe_interval; return base + fsm->probe_interval;
} }
return LLONG_MAX; return LLONG_MAX;
@@ -587,7 +587,7 @@ reconnect_run(struct reconnect *fsm, long long int now)
case S_ACTIVE: case S_ACTIVE:
VLOG_DBG("%s: idle %lld ms, sending inactivity probe", fsm->name, VLOG_DBG("%s: idle %lld ms, sending inactivity probe", fsm->name,
now - MAX(fsm->last_received, fsm->state_entered)); now - MAX(fsm->last_activity, fsm->state_entered));
reconnect_transition__(fsm, now, S_IDLE); reconnect_transition__(fsm, now, S_IDLE);
return RECONNECT_PROBE; return RECONNECT_PROBE;
@@ -673,7 +673,7 @@ reconnect_get_stats(const struct reconnect *fsm, long long int now,
struct reconnect_stats *stats) struct reconnect_stats *stats)
{ {
stats->creation_time = fsm->creation_time; stats->creation_time = fsm->creation_time;
stats->last_received = fsm->last_received; stats->last_activity = fsm->last_activity;
stats->last_connected = fsm->last_connected; stats->last_connected = fsm->last_connected;
stats->last_disconnected = fsm->last_disconnected; stats->last_disconnected = fsm->last_disconnected;
stats->backoff = fsm->backoff; stats->backoff = fsm->backoff;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, 2010 Nicira, Inc. * Copyright (c) 2009, 2010, 2012 Nicira, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@ void reconnect_listen_error(struct reconnect *, long long int now, int error);
void reconnect_connected(struct reconnect *, long long int now); void reconnect_connected(struct reconnect *, long long int now);
void reconnect_connect_failed(struct reconnect *, long long int now, void reconnect_connect_failed(struct reconnect *, long long int now,
int error); int error);
void reconnect_received(struct reconnect *, long long int now); void reconnect_activity(struct reconnect *, long long int now);
enum reconnect_action { enum reconnect_action {
RECONNECT_CONNECT = 1, RECONNECT_CONNECT = 1,
@@ -93,7 +93,7 @@ int reconnect_timeout(struct reconnect *, long long int now);
struct reconnect_stats { struct reconnect_stats {
/* All times and durations in this structure are in milliseconds. */ /* All times and durations in this structure are in milliseconds. */
long long int creation_time; /* Time reconnect_create() called. */ long long int creation_time; /* Time reconnect_create() called. */
long long int last_received; /* Last call to reconnect_received(). */ long long int last_activity; /* Last call to reconnect_activity(). */
long long int last_connected; /* Last call to reconnect_connected(). */ long long int last_connected; /* Last call to reconnect_connected(). */
long long int last_disconnected; /* Last call to reconnect_disconnected(). */ long long int last_disconnected; /* Last call to reconnect_disconnected(). */
int backoff; /* Current backoff duration. */ int backoff; /* Current backoff duration. */

View File

@@ -504,7 +504,7 @@ class Session(object):
if self.rpc is not None: if self.rpc is not None:
error, msg = self.rpc.recv() error, msg = self.rpc.recv()
if not error: if not error:
self.reconnect.received(ovs.timeval.msec()) self.reconnect.activity(ovs.timeval.msec())
if msg.type == Message.T_REQUEST and msg.method == "echo": if msg.type == Message.T_REQUEST and msg.method == "echo":
# Echo request. Send reply. # Echo request. Send reply.
self.send(Message.create_reply(msg.params, msg.id)) self.send(Message.create_reply(msg.params, msg.id))

View File

@@ -94,7 +94,7 @@ class Reconnect(object):
@staticmethod @staticmethod
def deadline(fsm): def deadline(fsm):
if fsm.probe_interval: if fsm.probe_interval:
base = max(fsm.last_received, fsm.state_entered) base = max(fsm.last_activity, fsm.state_entered)
return base + fsm.probe_interval return base + fsm.probe_interval
return None return None
@@ -102,7 +102,7 @@ class Reconnect(object):
def run(fsm, now): def run(fsm, now):
vlog.dbg("%s: idle %d ms, sending inactivity probe" vlog.dbg("%s: idle %d ms, sending inactivity probe"
% (fsm.name, % (fsm.name,
now - max(fsm.last_received, fsm.state_entered))) now - max(fsm.last_activity, fsm.state_entered)))
fsm._transition(now, Reconnect.Idle) fsm._transition(now, Reconnect.Idle)
return PROBE return PROBE
@@ -150,7 +150,7 @@ class Reconnect(object):
self.state = Reconnect.Void self.state = Reconnect.Void
self.state_entered = now self.state_entered = now
self.backoff = 0 self.backoff = 0
self.last_received = now self.last_activity = now
self.last_connected = None self.last_connected = None
self.last_disconnected = None self.last_disconnected = None
self.max_tries = None self.max_tries = None
@@ -204,8 +204,8 @@ class Reconnect(object):
"""Returns the "probe interval" in milliseconds. If this is zero, it """Returns the "probe interval" in milliseconds. If this is zero, it
disables the connection keepalive feature. If it is nonzero, then if disables the connection keepalive feature. If it is nonzero, then if
the interval passes while the FSM is connected and without the interval passes while the FSM is connected and without
self.received() being called, self.run() returns ovs.reconnect.PROBE. self.activity() being called, self.run() returns ovs.reconnect.PROBE.
If the interval passes again without self.received() being called, If the interval passes again without self.activity() being called,
self.run() returns ovs.reconnect.DISCONNECT.""" self.run() returns ovs.reconnect.DISCONNECT."""
return self.probe_interval return self.probe_interval
@@ -246,9 +246,9 @@ class Reconnect(object):
"""Sets the "probe interval" to 'probe_interval', in milliseconds. If """Sets the "probe interval" to 'probe_interval', in milliseconds. If
this is zero, it disables the connection keepalive feature. If it is this is zero, it disables the connection keepalive feature. If it is
nonzero, then if the interval passes while this FSM is connected and nonzero, then if the interval passes while this FSM is connected and
without self.received() being called, self.run() returns without self.activity() being called, self.run() returns
ovs.reconnect.PROBE. If the interval passes again without ovs.reconnect.PROBE. If the interval passes again without
self.received() being called, self.run() returns self.activity() being called, self.run() returns
ovs.reconnect.DISCONNECT. ovs.reconnect.DISCONNECT.
If 'probe_interval' is nonzero, then it will be forced to a value of at If 'probe_interval' is nonzero, then it will be forced to a value of at
@@ -354,7 +354,7 @@ class Reconnect(object):
# Back off # Back off
if (self.state in (Reconnect.Active, Reconnect.Idle) and if (self.state in (Reconnect.Active, Reconnect.Idle) and
(self.last_received - self.last_connected >= self.backoff or (self.last_activity - self.last_connected >= self.backoff or
self.passive)): self.passive)):
if self.passive: if self.passive:
self.backoff = 0 self.backoff = 0
@@ -426,7 +426,7 @@ class Reconnect(object):
"""Tell this FSM that the connection was successful. """Tell this FSM that the connection was successful.
The FSM will start the probe interval timer, which is reset by The FSM will start the probe interval timer, which is reset by
self.received(). If the timer expires, a probe will be sent (by self.activity(). If the timer expires, a probe will be sent (by
returning ovs.reconnect.PROBE from self.run(). If the timer expires returning ovs.reconnect.PROBE from self.run(). If the timer expires
again without being reset, the connection will be aborted (by returning again without being reset, the connection will be aborted (by returning
ovs.reconnect.DISCONNECT from self.run().""" ovs.reconnect.DISCONNECT from self.run()."""
@@ -444,12 +444,13 @@ class Reconnect(object):
self.connecting(now) self.connecting(now)
self.disconnected(now, error) self.disconnected(now, error)
def received(self, now): def activity(self, now):
"""Tell this FSM that some data was received. This resets the probe """Tell this FSM that some activity occurred on the connection. This
interval timer, so that the connection is known not to be idle.""" resets the probe interval timer, so that the connection is known not to
be idle."""
if self.state != Reconnect.Active: if self.state != Reconnect.Active:
self._transition(now, Reconnect.Active) self._transition(now, Reconnect.Active)
self.last_received = now self.last_activity = now
def _transition(self, now, state): def _transition(self, now, state):
if self.state == Reconnect.ConnectInProgress: if self.state == Reconnect.ConnectInProgress:
@@ -561,7 +562,7 @@ class Reconnect(object):
stats.creation_time = self.creation_time stats.creation_time = self.creation_time
stats.last_connected = self.last_connected stats.last_connected = self.last_connected
stats.last_disconnected = self.last_disconnected stats.last_disconnected = self.last_disconnected
stats.last_received = self.last_received stats.last_activity = self.last_activity
stats.backoff = self.backoff stats.backoff = self.backoff
stats.seqno = self.seqno stats.seqno = self.seqno
stats.is_connected = self.is_connected() stats.is_connected = self.is_connected()

View File

@@ -59,7 +59,7 @@ run
should connect should connect
connected connected
in ACTIVE for 0 ms (0 ms backoff) in ACTIVE for 0 ms (0 ms backoff)
created 1000, last received 1000, last connected 1000 created 1000, last activity 1000, last connected 1000
1 successful connections out of 1 attempts, seqno 1 1 successful connections out of 1 attempts, seqno 1
connected connected
last connected 0 ms ago, connected 0 ms total last connected 0 ms ago, connected 0 ms total
@@ -129,7 +129,7 @@ advance 500
run run
connected connected
in ACTIVE for 0 ms (0 ms backoff) in ACTIVE for 0 ms (0 ms backoff)
created 1000, last received 1000, last connected 1500 created 1000, last activity 1000, last connected 1500
1 successful connections out of 1 attempts, seqno 1 1 successful connections out of 1 attempts, seqno 1
connected connected
last connected 0 ms ago, connected 0 ms total last connected 0 ms ago, connected 0 ms total
@@ -408,7 +408,7 @@ run
should connect should connect
connected connected
in ACTIVE for 0 ms (0 ms backoff) in ACTIVE for 0 ms (0 ms backoff)
created 1000, last received 1000, last connected 1000 created 1000, last activity 1000, last connected 1000
1 successful connections out of 1 attempts, seqno 1 1 successful connections out of 1 attempts, seqno 1
connected connected
last connected 0 ms ago, connected 0 ms total last connected 0 ms ago, connected 0 ms total
@@ -448,7 +448,7 @@ run
should connect should connect
connected connected
in ACTIVE for 0 ms (1000 ms backoff) in ACTIVE for 0 ms (1000 ms backoff)
created 1000, last received 1000, last connected 12000 created 1000, last activity 1000, last connected 12000
2 successful connections out of 2 attempts, seqno 3 2 successful connections out of 2 attempts, seqno 3
connected connected
last connected 0 ms ago, connected 10000 ms total last connected 0 ms ago, connected 10000 ms total
@@ -488,7 +488,7 @@ run
should connect should connect
connected connected
in ACTIVE for 0 ms (2000 ms backoff) in ACTIVE for 0 ms (2000 ms backoff)
created 1000, last received 1000, last connected 24000 created 1000, last activity 1000, last connected 24000
3 successful connections out of 3 attempts, seqno 5 3 successful connections out of 3 attempts, seqno 5
connected connected
last connected 0 ms ago, connected 20000 ms total last connected 0 ms ago, connected 20000 ms total
@@ -625,7 +625,7 @@ advance 500
run run
connected connected
in ACTIVE for 0 ms (2000 ms backoff) in ACTIVE for 0 ms (2000 ms backoff)
created 1000, last received 1000, last connected 6500 created 1000, last activity 1000, last connected 6500
1 successful connections out of 3 attempts, seqno 1 1 successful connections out of 3 attempts, seqno 1
connected connected
last connected 0 ms ago, connected 0 ms total last connected 0 ms ago, connected 0 ms total
@@ -688,13 +688,13 @@ connected
# Connection receives 3 chunks of data spaced 250 ms apart. # Connection receives 3 chunks of data spaced 250 ms apart.
advance 250 advance 250
run run
received activity
advance 250 advance 250
run run
received activity
advance 250 advance 250
run run
received activity
# Connection drops. # Connection drops.
disconnected disconnected
@@ -767,7 +767,7 @@ advance 500
run run
connected connected
in ACTIVE for 0 ms (2000 ms backoff) in ACTIVE for 0 ms (2000 ms backoff)
created 1000, last received 1000, last connected 6500 created 1000, last activity 1000, last connected 6500
1 successful connections out of 3 attempts, seqno 1 1 successful connections out of 3 attempts, seqno 1
connected connected
last connected 0 ms ago, connected 0 ms total last connected 0 ms ago, connected 0 ms total
@@ -778,22 +778,22 @@ advance 250
### t=6750 ### ### t=6750 ###
in ACTIVE for 250 ms (2000 ms backoff) in ACTIVE for 250 ms (2000 ms backoff)
run run
received activity
created 1000, last received 6750, last connected 6500 created 1000, last activity 6750, last connected 6500
advance 250 advance 250
### t=7000 ### ### t=7000 ###
in ACTIVE for 500 ms (2000 ms backoff) in ACTIVE for 500 ms (2000 ms backoff)
run run
received activity
created 1000, last received 7000, last connected 6500 created 1000, last activity 7000, last connected 6500
advance 250 advance 250
### t=7250 ### ### t=7250 ###
in ACTIVE for 750 ms (2000 ms backoff) in ACTIVE for 750 ms (2000 ms backoff)
run run
received activity
created 1000, last received 7250, last connected 6500 created 1000, last activity 7250, last connected 6500
# Connection drops. # Connection drops.
disconnected disconnected
@@ -849,13 +849,13 @@ connected
# Connection receives 3 chunks of data spaced 2000 ms apart. # Connection receives 3 chunks of data spaced 2000 ms apart.
advance 2000 advance 2000
run run
received activity
advance 2000 advance 2000
run run
received activity
advance 2000 advance 2000
run run
received activity
# Connection drops. # Connection drops.
disconnected disconnected
@@ -928,7 +928,7 @@ advance 500
run run
connected connected
in ACTIVE for 0 ms (2000 ms backoff) in ACTIVE for 0 ms (2000 ms backoff)
created 1000, last received 1000, last connected 6500 created 1000, last activity 1000, last connected 6500
1 successful connections out of 3 attempts, seqno 1 1 successful connections out of 3 attempts, seqno 1
connected connected
last connected 0 ms ago, connected 0 ms total last connected 0 ms ago, connected 0 ms total
@@ -939,22 +939,22 @@ advance 2000
### t=8500 ### ### t=8500 ###
in ACTIVE for 2000 ms (2000 ms backoff) in ACTIVE for 2000 ms (2000 ms backoff)
run run
received activity
created 1000, last received 8500, last connected 6500 created 1000, last activity 8500, last connected 6500
advance 2000 advance 2000
### t=10500 ### ### t=10500 ###
in ACTIVE for 4000 ms (2000 ms backoff) in ACTIVE for 4000 ms (2000 ms backoff)
run run
received activity
created 1000, last received 10500, last connected 6500 created 1000, last activity 10500, last connected 6500
advance 2000 advance 2000
### t=12500 ### ### t=12500 ###
in ACTIVE for 6000 ms (2000 ms backoff) in ACTIVE for 6000 ms (2000 ms backoff)
run run
received activity
created 1000, last received 12500, last connected 6500 created 1000, last activity 12500, last connected 6500
# Connection drops. # Connection drops.
disconnected disconnected
@@ -1060,7 +1060,7 @@ run
should connect should connect
connected connected
in ACTIVE for 0 ms (0 ms backoff) in ACTIVE for 0 ms (0 ms backoff)
created 1000, last received 1000, last connected 1000 created 1000, last activity 1000, last connected 1000
1 successful connections out of 1 attempts, seqno 1 1 successful connections out of 1 attempts, seqno 1
connected connected
last connected 0 ms ago, connected 0 ms total last connected 0 ms ago, connected 0 ms total
@@ -1128,9 +1128,9 @@ listening
# Connection accepted. # Connection accepted.
connected connected
received activity
advance 1000 advance 1000
received activity
# Connection times out. # Connection times out.
timeout timeout
@@ -1178,18 +1178,18 @@ listening
# Connection accepted. # Connection accepted.
connected connected
in ACTIVE for 0 ms (1000 ms backoff) in ACTIVE for 0 ms (1000 ms backoff)
created 1000, last received 1000, last connected 2000 created 1000, last activity 1000, last connected 2000
1 successful connections out of 1 attempts, seqno 1 1 successful connections out of 1 attempts, seqno 1
connected connected
last connected 0 ms ago, connected 0 ms total last connected 0 ms ago, connected 0 ms total
received activity
created 1000, last received 2000, last connected 2000 created 1000, last activity 2000, last connected 2000
advance 1000 advance 1000
### t=3000 ### ### t=3000 ###
in ACTIVE for 1000 ms (1000 ms backoff) in ACTIVE for 1000 ms (1000 ms backoff)
received activity
created 1000, last received 3000, last connected 2000 created 1000, last activity 3000, last connected 2000
# Connection times out. # Connection times out.
timeout timeout

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, 2010, 2011 Nicira, Inc. * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -148,9 +148,9 @@ do_connected(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
} }
static void static void
do_received(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) do_activity(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{ {
reconnect_received(reconnect, now); reconnect_activity(reconnect, now);
} }
static void static void
@@ -220,10 +220,10 @@ diff_stats(const struct reconnect_stats *old,
new->state, new->state_elapsed, new->backoff); new->state, new->state_elapsed, new->backoff);
} }
if (old->creation_time != new->creation_time if (old->creation_time != new->creation_time
|| old->last_received != new->last_received || old->last_activity != new->last_activity
|| old->last_connected != new->last_connected) { || old->last_connected != new->last_connected) {
printf(" created %lld, last received %lld, last connected %lld\n", printf(" created %lld, last activity %lld, last connected %lld\n",
new->creation_time, new->last_received, new->last_connected); new->creation_time, new->last_activity, new->last_connected);
} }
if (old->n_successful_connections != new->n_successful_connections if (old->n_successful_connections != new->n_successful_connections
|| old->n_attempted_connections != new->n_attempted_connections || old->n_attempted_connections != new->n_attempted_connections
@@ -280,7 +280,7 @@ static const struct command commands[] = {
{ "connecting", 0, 0, do_connecting }, { "connecting", 0, 0, do_connecting },
{ "connect-failed", 0, 1, do_connect_failed }, { "connect-failed", 0, 1, do_connect_failed },
{ "connected", 0, 0, do_connected }, { "connected", 0, 0, do_connected },
{ "received", 0, 0, do_received }, { "activity", 0, 0, do_activity },
{ "run", 0, 1, do_run }, { "run", 0, 1, do_run },
{ "advance", 1, 1, do_advance }, { "advance", 1, 1, do_advance },
{ "timeout", 0, 0, do_timeout }, { "timeout", 0, 0, do_timeout },

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2009, 2010 Nicira, Inc. # Copyright (c) 2009, 2010, 2012 Nicira, Inc.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -61,8 +61,8 @@ def do_connected(_):
r.connected(now) r.connected(now)
def do_received(_): def do_activity(_):
r.received(now) r.activity(now)
def do_run(arg): def do_run(arg):
@@ -110,10 +110,10 @@ def diff_stats(old, new, delta):
% (new.state, new.state_elapsed, new.backoff)) % (new.state, new.state_elapsed, new.backoff))
if (old.creation_time != new.creation_time or if (old.creation_time != new.creation_time or
old.last_received != new.last_received or old.last_activity != new.last_activity or
old.last_connected != new.last_connected): old.last_connected != new.last_connected):
print(" created %d, last received %d, last connected %d" print(" created %d, last activity %d, last connected %d"
% (new.creation_time, new.last_received, new.last_connected)) % (new.creation_time, new.last_activity, new.last_connected))
if (old.n_successful_connections != new.n_successful_connections or if (old.n_successful_connections != new.n_successful_connections or
old.n_attempted_connections != new.n_attempted_connections or old.n_attempted_connections != new.n_attempted_connections or
@@ -166,7 +166,7 @@ def main():
"connecting": do_connecting, "connecting": do_connecting,
"connect-failed": do_connect_failed, "connect-failed": do_connect_failed,
"connected": do_connected, "connected": do_connected,
"received": do_received, "activity": do_activity,
"run": do_run, "run": do_run,
"advance": do_advance, "advance": do_advance,
"timeout": do_timeout, "timeout": do_timeout,