/* Drops any existing connection on 'rc', then sets up 'rc' to connect to * 'target' and reconnect as needed. 'target' should be a remote OpenFlow * target in a form acceptable to vconn_open(). * * If 'name' is nonnull, then it is used in log messages in place of 'target'. * It should presumably give more information to a human reader than 'target', * but it need not be acceptable to vconn_open(). */ void rconn_connect(struct rconn *rc, const char *target) { rconn_disconnect(rc); rconn_set_target__(rc, target); reconnect(rc); }
/* Drops any existing connection on 'rc', then sets up 'rc' to connect to * 'target' and reconnect as needed. 'target' should be a remote OpenFlow * target in a form acceptable to vconn_open(). * * If 'name' is nonnull, then it is used in log messages in place of 'target'. * It should presumably give more information to a human reader than 'target', * but it need not be acceptable to vconn_open(). */ void rconn_connect(struct rconn *rc, const char *target, const char *name) { rconn_disconnect(rc); rconn_set_target__(rc, target, name); rc->reliable = true; reconnect(rc); }
/* Drops any existing connection on 'rc', then configures 'rc' to use * 'vconn'. If the connection on 'vconn' drops, 'rc' will not reconnect on it * own. * * By default, the target obtained from vconn_get_name(vconn) is used in log * messages. If 'name' is nonnull, then it is used instead. It should * presumably give more information to a human reader than the target, but it * need not be acceptable to vconn_open(). */ void rconn_connect_unreliably(struct rconn *rc, struct vconn *vconn, const char *name) { assert(vconn != NULL); rconn_disconnect(rc); rconn_set_target__(rc, vconn_get_name(vconn)); // rc->reliable = false; rc->vconn = vconn; // rc->last_connected = time_now(); state_transition(rc, S_ACTIVE); }
void rconn_disconnect(struct rconn *rc) { if (rc->state != S_VOID) { if (rc->vconn) { vconn_close(rc->vconn); rc->vconn = NULL; } rconn_set_target__(rc, "void"); state_transition(rc, S_VOID); } }
void rconn_disconnect(struct rconn *rc) { if (rc->state != S_VOID) { if (rc->vconn) { vconn_close(rc->vconn); rc->vconn = NULL; } rconn_set_target__(rc, "void", NULL); rc->reliable = false; rc->backoff = 0; rc->backoff_deadline = TIME_MIN; state_transition(rc, S_VOID); } }