2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

jsonrpc: Notify excessive sending backlog.

This commit adds a log message to notify the excessive backlog
for jsonrpc.  Expectedly, this message should never be printed.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Alex Wang
2014-09-18 10:49:47 -07:00
parent 9c537baf61
commit 65b81af3b4

View File

@@ -47,6 +47,7 @@ struct jsonrpc {
/* Output. */
struct list output; /* Contains "struct ofpbuf"s. */
size_t output_count; /* Number of elements in "output". */
size_t backlog;
};
@@ -124,6 +125,7 @@ jsonrpc_run(struct jsonrpc *rpc)
ofpbuf_pull(buf, retval);
if (!ofpbuf_size(buf)) {
list_remove(&buf->list_node);
rpc->output_count--;
ofpbuf_delete(buf);
}
} else {
@@ -257,8 +259,15 @@ jsonrpc_send(struct jsonrpc *rpc, struct jsonrpc_msg *msg)
ofpbuf_use(buf, s, length);
ofpbuf_set_size(buf, length);
list_push_back(&rpc->output, &buf->list_node);
rpc->output_count++;
rpc->backlog += length;
if (rpc->output_count >= 50) {
VLOG_INFO_RL(&rl, "excessive sending backlog, jsonrpc: %s, num of"
" msgs: %"PRIuSIZE", backlog: %"PRIuSIZE".", rpc->name,
rpc->output_count, rpc->backlog);
}
if (rpc->backlog == length) {
jsonrpc_run(rpc);
}
@@ -496,6 +505,7 @@ jsonrpc_cleanup(struct jsonrpc *rpc)
ofpbuf_list_delete(&rpc->output);
rpc->backlog = 0;
rpc->output_count = 0;
}
static struct jsonrpc_msg *