rconn: Drop rconn_new(), rconn_new_from_vconn() functions.
authorBen Pfaff <blp@nicira.com>
Thu, 3 Jun 2010 21:41:35 +0000 (14:41 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 8 Jun 2010 17:35:53 +0000 (10:35 -0700)
There are enough rconn functions without these helpers, which weren't used
much in practice.

extras/ezio/ovs-switchui.c
lib/rconn.c
lib/rconn.h
ofproto/ofproto.c
utilities/ovs-controller.c

index 6ebfece..a1adcc5 100644 (file)
@@ -160,7 +160,8 @@ main(int argc, char *argv[])
                   "use --help for help");
     }
 
-    rconn = rconn_new(argv[0], 5, 5);
+    rconn = rconn_create(5, 5);
+    rconn_connect(rconn, argv[0]);
 
     die_if_already_running();
     daemonize();
index a26b037..7d9592a 100644 (file)
@@ -145,24 +145,6 @@ static void copy_to_monitor(struct rconn *, const struct ofpbuf *);
 static bool is_connected_state(enum state);
 static bool is_admitted_msg(const struct ofpbuf *);
 
-/* Creates a new rconn, connects it (reliably) to 'name', and returns it. */
-struct rconn *
-rconn_new(const char *name, int inactivity_probe_interval, int max_backoff)
-{
-    struct rconn *rc = rconn_create(inactivity_probe_interval, max_backoff);
-    rconn_connect(rc, name);
-    return rc;
-}
-
-/* Creates a new rconn, connects it (unreliably) to 'vconn', and returns it. */
-struct rconn *
-rconn_new_from_vconn(struct vconn *vconn) 
-{
-    struct rconn *rc = rconn_create(60, 0);
-    rconn_connect_unreliably(rc, vconn);
-    return rc;
-}
-
 /* Creates and returns a new rconn.
  *
  * 'probe_interval' is a number of seconds.  If the interval passes once
@@ -174,7 +156,10 @@ rconn_new_from_vconn(struct vconn *vconn)
  * 'max_backoff' is the maximum number of seconds between attempts to connect
  * to the peer.  The actual interval starts at 1 second and doubles on each
  * failure until it reaches 'max_backoff'.  If 0 is specified, the default of
- * 8 seconds is used. */
+ * 8 seconds is used.
+ *
+ * The new rconn is initially unconnected.  Use rconn_connect() or
+ * rconn_connect_unreliably() to connect it. */
 struct rconn *
 rconn_create(int probe_interval, int max_backoff)
 {
index aa9d76c..8222852 100644 (file)
@@ -37,9 +37,6 @@
 struct vconn;
 struct rconn_packet_counter;
 
-struct rconn *rconn_new(const char *name, 
-                        int inactivity_probe_interval, int max_backoff);
-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);
index adb836b..bf5081b 100644 (file)
@@ -1078,7 +1078,11 @@ ofproto_run1(struct ofproto *p)
 
         retval = pvconn_accept(p->listeners[i], OFP_VERSION, &vconn);
         if (!retval) {
-            ofconn_create(p, rconn_new_from_vconn(vconn), OFCONN_TRANSIENT);
+            struct rconn *rconn;
+
+            rconn = rconn_create(60, 0);
+            rconn_connect_unreliably(rconn, vconn);
+            ofconn_create(p, rconn, OFCONN_TRANSIENT);
         } else if (retval != EAGAIN) {
             VLOG_WARN_RL(&rl, "accept failed (%s)", strerror(retval));
         }
index 19eec15..8de3400 100644 (file)
@@ -210,7 +210,8 @@ main(int argc, char *argv[])
 static void
 new_switch(struct switch_ *sw, struct vconn *vconn)
 {
-    sw->rconn = rconn_new_from_vconn(vconn);
+    sw->rconn = rconn_create(60, 0);
+    rconn_connect_unreliably(sw->rconn, vconn);
     sw->lswitch = lswitch_create(sw->rconn, learn_macs, exact_flows,
                                  set_up_flows ? max_idle : -1,
                                  action_normal);