Merge pull request #165 from cie/fix-connection-count

Fix connection count
This commit is contained in:
Yichi Chiang 2017-10-03 14:03:54 -07:00 committed by GitHub Enterprise
commit 25870189ae
1 changed files with 10 additions and 7 deletions

View File

@ -381,7 +381,16 @@ struct Peer : NonCopyable {
self->outgoingConnectionIdle = false;
}
Void _ = wait( connectionWriter( self, conn ) || reader || connectionMonitor(self) );
try {
self->transport->countConnEstablished++;
Void _ = wait( connectionWriter( self, conn ) || reader || connectionMonitor(self) );
} catch (Error& e) {
if (e.code() == error_code_connection_failed || e.code() == error_code_actor_cancelled || ( g_network->isSimulated() && e.code() == error_code_checksum_failed ))
self->transport->countConnClosedWithoutError++;
else
self->transport->countConnClosedWithError++;
throw e;
}
ASSERT( false );
} catch (Error& e) {
@ -396,10 +405,6 @@ struct Peer : NonCopyable {
if(self->compatible) {
TraceEvent(ok ? SevInfo : SevError, "ConnectionClosed", conn ? conn->getDebugID() : UID()).detail("PeerAddr", self->destination).error(e, true);
if (ok)
self->transport->countConnClosedWithoutError++;
else
self->transport->countConnClosedWithError++;
}
else {
TraceEvent(ok ? SevInfo : SevError, "IncompatibleConnectionClosed", conn ? conn->getDebugID() : UID()).detail("PeerAddr", self->destination).error(e, true);
@ -626,8 +631,6 @@ ACTOR static Future<Void> connectionReader(
TraceEvent("ConnectionEstablished", conn->getDebugID())
.detail("Peer", conn->getPeerAddress())
.detail("ConnectionId", connectionId);
transport->countConnEstablished++;
}
if(connectionId > 1) {