jsonrpc: Return received JSON-RPC messages immediately in jsonrpc_recv().
authorBen Pfaff <blp@nicira.com>
Thu, 3 Apr 2014 22:27:18 +0000 (15:27 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 3 Apr 2014 23:11:09 +0000 (16:11 -0700)
commit79bda8258b5365438a70d08c74fab903f1dc0a29
tree960aac8a481b10a490d7f6eba134c7c8bcf6cb41
parent6b83a3c5c37a07118681a3738ec776a7d8485a3f
jsonrpc: Return received JSON-RPC messages immediately in jsonrpc_recv().

Until now, jsonrpc_recv() used separate iterations of its loop to receive
data, feed it to the JSON-RPC parser, and return the received message.
This is unnecessarily complicated and can occasionally mean that the
jsonrpc object has received and parsed but not returned a message.  This
commit refactors the code to receive data, feed it to the parse, and
return the received message in a single iteration, and simplifies the code
in the process.

Reported-by: Chris Hydon <chydon@aristanetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
AUTHORS
lib/jsonrpc.c