From e87f74d6ea6e3b9381818bc59f4d2abf5a0a2185 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 10 Mar 2009 16:54:00 -0700 Subject: [PATCH] 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. --- secchan/ofproto.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- 2.30.2