From: Ben Pfaff Date: Wed, 4 Mar 2009 17:56:47 +0000 (-0800) Subject: rconn: Add new function rconn_reconnect(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6be49af362bad508e8994d581daa163ca28b85e7;p=openvswitch rconn: Add new function rconn_reconnect(). --- diff --git a/lib/rconn.c b/lib/rconn.c index a37f9fb8..562f96f3 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -272,6 +272,15 @@ rconn_connect_unreliably(struct rconn *rc, state_transition(rc, S_ACTIVE); } +/* If 'rc' is connected, forces it to drop the connection and reconnect. */ +void +rconn_reconnect(struct rconn *rc) +{ + if (rc->state & (S_ACTIVE | S_IDLE)) { + disconnect(rc, 0); + } +} + void rconn_disconnect(struct rconn *rc) { diff --git a/lib/rconn.h b/lib/rconn.h index f804b9a7..93ccec05 100644 --- a/lib/rconn.h +++ b/lib/rconn.h @@ -67,6 +67,7 @@ int rconn_get_probe_interval(const struct rconn *); int rconn_connect(struct rconn *, const char *name); void rconn_connect_unreliably(struct rconn *, const char *name, struct vconn *vconn); +void rconn_reconnect(struct rconn *); void rconn_disconnect(struct rconn *); void rconn_destroy(struct rconn *);