mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
jsonrpc: Properly implement connection timeout.
jsonrpc_session_connect() indirectly called reconnect_disconnected(), which told the reconnect object that the connection had failed, before it told it that the connection attempt had started. When the connection didn't complete immediately, this caused the connection to time out immediately, without any backoff. Reported by Jeremy Stribling.
This commit is contained in:
@@ -686,7 +686,6 @@ jsonrpc_session_close(struct jsonrpc_session *s)
|
||||
static void
|
||||
jsonrpc_session_disconnect(struct jsonrpc_session *s)
|
||||
{
|
||||
reconnect_disconnected(s->reconnect, time_msec(), 0);
|
||||
if (s->rpc) {
|
||||
jsonrpc_error(s->rpc, EOF);
|
||||
jsonrpc_close(s->rpc);
|
||||
@@ -723,6 +722,7 @@ jsonrpc_session_run(struct jsonrpc_session *s)
|
||||
jsonrpc_run(s->rpc);
|
||||
error = jsonrpc_get_status(s->rpc);
|
||||
if (error) {
|
||||
reconnect_disconnected(s->reconnect, time_msec(), 0);
|
||||
jsonrpc_session_disconnect(s);
|
||||
}
|
||||
} else if (s->stream) {
|
||||
@@ -747,6 +747,7 @@ jsonrpc_session_run(struct jsonrpc_session *s)
|
||||
break;
|
||||
|
||||
case RECONNECT_DISCONNECT:
|
||||
reconnect_disconnected(s->reconnect, time_msec(), 0);
|
||||
jsonrpc_session_disconnect(s);
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user