X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Freconnect.h;h=997a03f218d9806da0e07ca8a9e4e867fb757a32;hb=541bc79f73add327072470c9bc3febb4195cdb3c;hp=d0790ec6f797ce3f8d0e7c152523745ea139aba8;hpb=19df7f512c50e453c8eaa97675e213b4d6e9735d;p=openvswitch diff --git a/lib/reconnect.h b/lib/reconnect.h index d0790ec6..997a03f2 100644 --- a/lib/reconnect.h +++ b/lib/reconnect.h @@ -35,9 +35,16 @@ struct reconnect *reconnect_create(long long int now); void reconnect_destroy(struct reconnect *); +void reconnect_set_quiet(struct reconnect *, bool quiet); + const char *reconnect_get_name(const struct reconnect *); void reconnect_set_name(struct reconnect *, const char *name); +/* Defaults, all in msecs. */ +#define RECONNECT_DEFAULT_MIN_BACKOFF 1000 +#define RECONNECT_DEFAULT_MAX_BACKOFF 8000 +#define RECONNECT_DEFAULT_PROBE_INTERVAL 5000 + int reconnect_get_min_backoff(const struct reconnect *); int reconnect_get_max_backoff(const struct reconnect *); int reconnect_get_probe_interval(const struct reconnect *); @@ -60,8 +67,10 @@ void reconnect_disable(struct reconnect *, long long int now); void reconnect_force_reconnect(struct reconnect *, long long int now); bool reconnect_is_connected(const struct reconnect *); -unsigned int reconnect_get_connection_duration(const struct reconnect *, - long long int now); +unsigned int reconnect_get_last_connect_elapsed(const struct reconnect *, + long long int now); +unsigned int reconnect_get_last_disconnect_elapsed(const struct reconnect *, + long long int now); void reconnect_disconnected(struct reconnect *, long long int now, int error); void reconnect_connecting(struct reconnect *, long long int now); @@ -83,16 +92,18 @@ int reconnect_timeout(struct reconnect *, long long int now); struct reconnect_stats { /* All times and durations in this structure are in milliseconds. */ - long long int creation_time; /* Time reconnect_create() called. */ - long long int last_received; /* Last call to reconnect_received(). */ - long long int last_connected; /* Last call to reconnect_connected(). */ - int backoff; /* Current backoff duration. */ - - unsigned int seqno; /* # of connections + # of disconnections. */ - - bool is_connected; /* Currently connected? */ - unsigned int current_connection_duration; /* Time of current connection. */ - unsigned int total_connected_duration; /* Sum of all connections. */ + long long int creation_time; /* Time reconnect_create() called. */ + long long int last_received; /* Last call to reconnect_received(). */ + long long int last_connected; /* Last call to reconnect_connected(). */ + long long int last_disconnected; /* Last call to reconnect_disconnected(). */ + int backoff; /* Current backoff duration. */ + + unsigned int seqno; /* # of connections + # of disconnections. */ + + bool is_connected; /* Currently connected? */ + unsigned int msec_since_connect; /* Time since last connect. */ + unsigned int msec_since_disconnect; /* Time since last disconnect. */ + unsigned int total_connected_duration; /* Sum of all connections. */ unsigned int n_attempted_connections; unsigned int n_successful_connections;