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.
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);
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) {
break;
case RECONNECT_DISCONNECT:
+ reconnect_disconnected(s->reconnect, time_msec(), 0);
jsonrpc_session_disconnect(s);
break;