From: Ben Pfaff Date: Tue, 10 Mar 2009 23:54:00 +0000 (-0700) Subject: secchan: In ofproto_set_controller(), only reconnect if controller really changed. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e87f74d6ea6e3b9381818bc59f4d2abf5a0a2185;p=openvswitch secchan: In ofproto_set_controller(), only reconnect if controller really changed. The vswitchd bridge code tries not to call this function if it doesn't have to, but it's not doing a good job. We should fix it in vswitchd, but it's also a good idea to do it here. --- diff --git a/secchan/ofproto.c b/secchan/ofproto.c index 9711515e..9a49a111 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -398,7 +398,11 @@ ofproto_set_controller(struct ofproto *ofproto, const char *controller) if (ofproto->discovery) { return EINVAL; } else if (controller) { - return rconn_connect(ofproto->controller->rconn, controller); + if (strcmp(rconn_get_name(ofproto->controller->rconn), controller)) { + return rconn_connect(ofproto->controller->rconn, controller); + } else { + return 0; + } } else { rconn_disconnect(ofproto->controller->rconn); return 0;