Simplify code by using rconn_send_with_limit() helper function.
[openvswitch] / switch / datapath.c
index c25bc3e1cafb12a04bfac70b1b8b2360b1064fd8..953a30ba4433eb3a85e03595d591750ab33ca75f 100644 (file)
@@ -440,6 +440,7 @@ remote_create(struct datapath *dp, struct rconn *rconn)
     list_push_back(&dp->remotes, &remote->node);
     remote->rconn = rconn;
     remote->cb_dump = NULL;
+    remote->n_txq = 0;
     return remote;
 }
 
@@ -608,13 +609,10 @@ send_openflow_buffer(struct datapath *dp, struct buffer *buffer,
     int retval;
 
     update_openflow_length(buffer);
-    retval = (remote->n_txq < TXQ_LIMIT
-              ? rconn_send(rconn, buffer, &remote->n_txq)
-              : EAGAIN);
+    retval = rconn_send_with_limit(rconn, buffer, &remote->n_txq, TXQ_LIMIT);
     if (retval) {
         VLOG_WARN_RL(&rl, "send to %s failed: %s",
                      rconn_get_name(rconn), strerror(retval));
-        buffer_delete(buffer);
     }
     return retval;
 }