mirror of
https://github.com/openvswitch/ovs
synced 2025-10-23 14:57:06 +00:00
rconn: Simplify rconn_send() semantics.
Before this patch, rconn_send() would delete 'b' on success, and not on error. This is confusing and error-prone. This patch causes rconn_send() to always delete 'b'. Signed-off-by: Ethan Jackson <ethan@nicira.com>
This commit is contained in:
@@ -178,7 +178,6 @@ lswitch_create(struct rconn *rconn, const struct lswitch_config *cfg)
|
||||
if (error) {
|
||||
VLOG_INFO_RL(&rl, "%s: failed to queue default flows (%s)",
|
||||
rconn_get_name(rconn), strerror(error));
|
||||
ofpbuf_delete(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -560,9 +560,8 @@ rconn_recv_wait(struct rconn *rc)
|
||||
}
|
||||
}
|
||||
|
||||
/* Sends 'b' on 'rc'. Returns 0 if successful (in which case 'b' is
|
||||
* destroyed), or ENOTCONN if 'rc' is not currently connected (in which case
|
||||
* the caller retains ownership of 'b').
|
||||
/* Sends 'b' on 'rc'. Returns 0 if successful, or ENOTCONN if 'rc' is not
|
||||
* currently connected. Takes ownership of 'b'.
|
||||
*
|
||||
* If 'counter' is non-null, then 'counter' will be incremented while the
|
||||
* packet is in flight, then decremented when it has been sent (or discarded
|
||||
@@ -595,6 +594,7 @@ rconn_send(struct rconn *rc, struct ofpbuf *b,
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
ofpbuf_delete(b);
|
||||
return ENOTCONN;
|
||||
}
|
||||
}
|
||||
@@ -619,7 +619,6 @@ rconn_send_with_limit(struct rconn *rc, struct ofpbuf *b,
|
||||
retval = counter->n >= queue_limit ? EAGAIN : rconn_send(rc, b, counter);
|
||||
if (retval) {
|
||||
COVERAGE_INC(rconn_overflow);
|
||||
ofpbuf_delete(b);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1225,9 +1225,7 @@ ofconn_send(const struct ofconn *ofconn, struct ofpbuf *msg,
|
||||
struct rconn_packet_counter *counter)
|
||||
{
|
||||
update_openflow_length(msg);
|
||||
if (rconn_send(ofconn->rconn, msg, counter)) {
|
||||
ofpbuf_delete(msg);
|
||||
}
|
||||
rconn_send(ofconn->rconn, msg, counter);
|
||||
}
|
||||
|
||||
/* Sending asynchronous messages. */
|
||||
|
||||
Reference in New Issue
Block a user