On 3/3/25 10:19, Martin Morgenstern via dev wrote:
> This change makes it visible how often we cannot receive a full JSON
> message with a single jsonrpc_recv() call.
> 
> Signed-off-by: Martin Morgenstern <[email protected]>
> ---
>  lib/jsonrpc.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c
> index ae55e2113..0a2b8dd7d 100644
> --- a/lib/jsonrpc.c
> +++ b/lib/jsonrpc.c
> @@ -39,6 +39,7 @@
>  VLOG_DEFINE_THIS_MODULE(jsonrpc);
>  
>  COVERAGE_DEFINE(jsonrpc_gratuitous_echo);
> +COVERAGE_DEFINE(jsonrpc_recv_needs_retry);
>  
>  struct jsonrpc {
>      struct stream *stream;
> @@ -388,6 +389,10 @@ jsonrpc_recv(struct jsonrpc *rpc, struct jsonrpc_msg 
> **msgp)
>          }
>      }
>  
> +    /* We tried hard but didn't get a complete JSON message within the above
> +     * iterations. We want to know how often we abort for this reason. */

bit:  Double spaces between sentences.

> +    COVERAGE_INC(jsonrpc_recv_needs_retry);

Maybe 'jsonrpc_recv_incomplete' would be a better name?  Retry may be
needed for other reasons, but this one is specifically for the case where
we're receiving a potentially large message and it is not complete after
50 iterations.

What do you think?

> +
>      return EAGAIN;
>  }
>  

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to