From: Ben Pfaff Date: Thu, 3 Jun 2010 21:19:33 +0000 (-0700) Subject: rconn: Drop 'name' arg to rconn_new_from_vconn(), rconn_connect_unreliably(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58bdd0925ede5e74060c972bdcbffa3ef03cbd50;p=openvswitch rconn: Drop 'name' arg to rconn_new_from_vconn(), rconn_connect_unreliably(). The 'name' argument to these functions is actively unhelpful, because none of the callers provided a better name than the one provided by vconn_get_name(). So drop it. --- diff --git a/lib/rconn.c b/lib/rconn.c index 71198ea7..a26b0370 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -156,10 +156,10 @@ rconn_new(const char *name, int inactivity_probe_interval, int max_backoff) /* Creates a new rconn, connects it (unreliably) to 'vconn', and returns it. */ struct rconn * -rconn_new_from_vconn(const char *name, struct vconn *vconn) +rconn_new_from_vconn(struct vconn *vconn) { struct rconn *rc = rconn_create(60, 0); - rconn_connect_unreliably(rc, name, vconn); + rconn_connect_unreliably(rc, vconn); return rc; } @@ -257,12 +257,11 @@ rconn_connect(struct rconn *rc, const char *name) } void -rconn_connect_unreliably(struct rconn *rc, - const char *name, struct vconn *vconn) +rconn_connect_unreliably(struct rconn *rc, struct vconn *vconn) { assert(vconn != NULL); rconn_disconnect(rc); - set_vconn_name(rc, name); + set_vconn_name(rc, vconn_get_name(vconn)); rc->reliable = false; rc->vconn = vconn; rc->last_connected = time_now(); diff --git a/lib/rconn.h b/lib/rconn.h index 765e88cc..aa9d76c1 100644 --- a/lib/rconn.h +++ b/lib/rconn.h @@ -39,7 +39,7 @@ struct rconn_packet_counter; struct rconn *rconn_new(const char *name, int inactivity_probe_interval, int max_backoff); -struct rconn *rconn_new_from_vconn(const char *name, struct vconn *); +struct rconn *rconn_new_from_vconn(struct vconn *); struct rconn *rconn_create(int inactivity_probe_interval, int max_backoff); void rconn_set_max_backoff(struct rconn *, int max_backoff); @@ -48,8 +48,7 @@ void rconn_set_probe_interval(struct rconn *, int inactivity_probe_interval); 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_connect_unreliably(struct rconn *, struct vconn *vconn); void rconn_reconnect(struct rconn *); void rconn_disconnect(struct rconn *); void rconn_destroy(struct rconn *); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 0fd2fdfb..adb836bc 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1078,8 +1078,7 @@ ofproto_run1(struct ofproto *p) retval = pvconn_accept(p->listeners[i], OFP_VERSION, &vconn); if (!retval) { - ofconn_create(p, rconn_new_from_vconn("passive", vconn), - OFCONN_TRANSIENT); + ofconn_create(p, rconn_new_from_vconn(vconn), OFCONN_TRANSIENT); } else if (retval != EAGAIN) { VLOG_WARN_RL(&rl, "accept failed (%s)", strerror(retval)); } diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c index 30acc8ba..19eec15e 100644 --- a/utilities/ovs-controller.c +++ b/utilities/ovs-controller.c @@ -71,7 +71,7 @@ static bool mute = false; static char *unixctl_path = NULL; static int do_switching(struct switch_ *); -static void new_switch(struct switch_ *, struct vconn *, const char *name); +static void new_switch(struct switch_ *, struct vconn *); static void parse_options(int argc, char *argv[]); static void usage(void) NO_RETURN; @@ -108,7 +108,7 @@ main(int argc, char *argv[]) if (n_switches >= MAX_SWITCHES) { ovs_fatal(0, "max %d switch connections", n_switches); } - new_switch(&switches[n_switches++], vconn, name); + new_switch(&switches[n_switches++], vconn); continue; } else if (retval == EAFNOSUPPORT) { struct pvconn *pvconn; @@ -150,7 +150,7 @@ main(int argc, char *argv[]) retval = pvconn_accept(listeners[i], OFP_VERSION, &new_vconn); if (!retval || retval == EAGAIN) { if (!retval) { - new_switch(&switches[n_switches++], new_vconn, "tcp"); + new_switch(&switches[n_switches++], new_vconn); } i++; } else { @@ -208,9 +208,9 @@ main(int argc, char *argv[]) } static void -new_switch(struct switch_ *sw, struct vconn *vconn, const char *name) +new_switch(struct switch_ *sw, struct vconn *vconn) { - sw->rconn = rconn_new_from_vconn(name, vconn); + sw->rconn = rconn_new_from_vconn(vconn); sw->lswitch = lswitch_create(sw->rconn, learn_macs, exact_flows, set_up_flows ? max_idle : -1, action_normal);