throws of connection_failed() from net()->connect did not result in clients marking a connection as failed in the failure monitor

This commit is contained in:
Evan Tschannen 2019-11-21 13:08:59 -08:00
parent 2727b91c46
commit 569c6d4476
1 changed files with 14 additions and 1 deletions

View File

@ -428,7 +428,19 @@ ACTOR Future<Void> connectionKeeper( Reference<Peer> self,
self->lastConnectTime = now();
TraceEvent("ConnectingTo", conn ? conn->getDebugID() : UID()).suppressFor(1.0).detail("PeerAddr", self->destination);
Reference<IConnection> _conn = wait( timeout( INetworkConnections::net()->connect(self->destination), FLOW_KNOBS->CONNECTION_MONITOR_TIMEOUT, Reference<IConnection>() ) );
state Reference<IConnection> _conn;
try {
choose {
when( Reference<IConnection> t = wait( INetworkConnections::net()->connect(self->destination) ) ) { _conn = t; }
when( wait( delay( FLOW_KNOBS->CONNECTION_MONITOR_TIMEOUT ) ) ) {}
}
} catch( Error &e ) {
if(e.code() != error_code_connection_failed) {
throw;
}
}
if (_conn) {
if (FlowTransport::transport().isClient()) {
IFailureMonitor::failureMonitor().setStatus(self->destination, FailureStatus(false));
@ -448,6 +460,7 @@ ACTOR Future<Void> connectionKeeper( Reference<Peer> self,
TraceEvent("ConnectionTimedOut", conn ? conn->getDebugID() : UID()).suppressFor(1.0).detail("PeerAddr", self->destination);
if (FlowTransport::transport().isClient()) {
IFailureMonitor::failureMonitor().setStatus(self->destination, FailureStatus(true));
clientReconnectDelay = true;
}
throw connection_failed();
}