On 2014-04-03 3:34 PM, Ben Pfaff wrote:
On Thu, Apr 03, 2014 at 03:06:03PM -0700, Chris Hydon wrote:
Previously, if the final iteration of the loop in jsonrpc_recv reads or
parses the last portion of a json object, it will return EAGAIN, with
the next call to jsonrpc_recv setting the message pointer. This can be
problematic if external code uses this function in conjunction with a
check on the socket's file descripitor. With this change, the loop does
not end if the byte queue is non-empty unless the parser has completed,
in which case the message pointer will always be set to the parsed
message.

Signed-off-by: Chris Hydon<chy...@aristanetworks.com>
I see the problem but I think that overall the code is just
unnecessarily complicated here.  I sent out an alternative patch that
makes it simpler and should fix the same problem.  Will you review it?
It is posted here:
         http://openvswitch.org/pipermail/dev/2014-April/038437.html
Thanks.

It looks like your change also fixes the problem, and I don't see any bugs. I agree entirely: the current code is needlessly complex! My only comment is that with your change, for long messages up to twice as much is read from the socket as before. If 50 was a strategically chosen value, the number of loops maybe ought to be reduced to 25, otherwise this is not an issue.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to