From patchwork Sat Oct 7 00:44:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 822856 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y87FB0Rq9z9t5C for ; Sat, 7 Oct 2017 11:49:34 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id D59C6BC8; Sat, 7 Oct 2017 00:45:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 729EDBC8 for ; Sat, 7 Oct 2017 00:45:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 128D7470 for ; Sat, 7 Oct 2017 00:45:32 +0000 (UTC) X-Originating-IP: 173.228.112.34 Received: from sigabrt.gateway.sonic.net (173-228-112-34.dsl.dynamic.fusionbroadband.com [173.228.112.34]) (Authenticated sender: blp@ovn.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id CB0D4A80C7; Sat, 7 Oct 2017 02:45:29 +0200 (CEST) From: Ben Pfaff To: dev@openvswitch.org Date: Fri, 6 Oct 2017 17:44:53 -0700 Message-Id: <20171007004458.5788-9-blp@ovn.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20171007004458.5788-1-blp@ovn.org> References: <20171007004458.5788-1-blp@ovn.org> X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 08/13] jsonrpc: Increment sequence number when connection actually made. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The purpose of the sequence number is to allow the client to figure out when the connection status has changed. The significant event for the client is when a connection completes, not when a connection attempt starts. Thus, this commit changes the code to increment the sequence number at completion, not at the attempt. Signed-off-by: Ben Pfaff Acked-by: Russell Bryant --- lib/jsonrpc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index 36fbdb4a622d..c9e4010b9b39 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -857,7 +857,7 @@ jsonrpc_session_open_unreliably(struct jsonrpc *jsonrpc, uint8_t dscp) s->rpc = jsonrpc; s->stream = NULL; s->pstream = NULL; - s->seqno = 0; + s->seqno = 1; return s; } @@ -919,7 +919,6 @@ jsonrpc_session_connect(struct jsonrpc_session *s) reconnect_connect_failed(s->reconnect, time_msec(), error); jsonrpc_session_pick_remote(s); } - s->seqno++; } void @@ -939,6 +938,7 @@ jsonrpc_session_run(struct jsonrpc_session *s) } reconnect_connected(s->reconnect, time_msec()); s->rpc = jsonrpc_open(stream); + s->seqno++; } else if (error != EAGAIN) { reconnect_listen_error(s->reconnect, time_msec(), error); pstream_close(s->pstream); @@ -979,6 +979,7 @@ jsonrpc_session_run(struct jsonrpc_session *s) reconnect_connected(s->reconnect, time_msec()); s->rpc = jsonrpc_open(s->stream); s->stream = NULL; + s->seqno++; } else if (error != EAGAIN) { reconnect_connect_failed(s->reconnect, time_msec(), error); jsonrpc_session_pick_remote(s);