Fixed bug where incompatible connection count was sometimes decremented twice for the same peer.

This commit is contained in:
Stephen Atherton 2018-07-27 20:48:14 -07:00
parent 6a3834c3f8
commit 59e005485d
1 changed files with 2 additions and 1 deletions

View File

@ -585,6 +585,7 @@ ACTOR static Future<Void> connectionReader(
state bool expectConnectPacket = true;
state bool compatible = false;
state bool incompatibleProtocolVersionNewer = false;
state bool initiallyCompatible = (peer == nullptr) || peer->compatible;
state NetworkAddress peerAddress;
state uint64_t peerProtocolVersion = 0;
@ -709,7 +710,7 @@ ACTOR static Future<Void> connectionReader(
}
}
catch (Error& e) {
if (peer && !peer->compatible) {
if (initiallyCompatible && peer && !peer->compatible) {
ASSERT(peer->transport->numIncompatibleConnections > 0);
peer->transport->numIncompatibleConnections--;
}