mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
jsonrpc: Increment sequence number when connection actually made.
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 <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
This commit is contained in:
@@ -826,7 +826,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;
|
||||
}
|
||||
@@ -883,7 +883,6 @@ jsonrpc_session_connect(struct jsonrpc_session *s)
|
||||
if (error) {
|
||||
reconnect_connect_failed(s->reconnect, time_msec(), error);
|
||||
}
|
||||
s->seqno++;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -903,6 +902,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);
|
||||
@@ -943,6 +943,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);
|
||||
stream_close(s->stream);
|
||||
|
Reference in New Issue
Block a user