Added multinode_Sim_Pruning_HardLimit test
- Fix numberOfConnections call to be number of incommingConnections and not countPrunableConnections
- Changed everything to countIncomingConnections
- Applied pruning on:
- OutboundIdleStateDuplex -> InboundStateDuplex;
- OutboundStateDuplex -> DuplexState
- Tweaked DemoteToColdLocal PruneConnections constructor
- Changed prune connections code:
- for OutboundIdleStateDuplex -> InboundStateDuplex transition, prune
code is pretty much the same except we have to check for
(numberOfConns + 1) -- See Summary
- for OutboundStateDuplex -> DuplexState transition, prune code has to
check for (numberOfConns + 1) and also forcefully be contained
inside its toPrune Set -- See Summary
- for DuplexState -> InboundStateDuplex transition, prune code has to
take into account if the connection is contained in its toPrune Set.
If so we shouldn't update the connection to the new state as we
might go above hardlimit.
- Tweaked MultiNodeScriptPruning and fixed shrink function
- Fix acceptLoop to handle the race condition with runConnectionRateLimits.
If after accept successfully returns we get above the hardlimit, then cancel the accepted connection
- Fixed classifyPruning function
In order for us to never go above hard limit connections we need to make sure that connections that evolve via OutboundDupSt Ticking → InboundIdleSt Duplex and via OutboundState Duplex -> DuplexState to use 'numberOfConns + 1' because we want to know if we actually let those connection to evolve if we need to make room for them by pruning.
For OutboundState Duplex -> DuplexState we also need to include it on its own pruneSet, since this connection might be a Sim-open connection and we are above the hardlimit, we really need to prune this connection in order to preserve the hard limit.
Due to the inherent race condition between accept and runConnectionRateLimits in the acceptLoop, we need to, after successfully running accept, check if accepting that connection put us above the hard limit. If it does then we need to cancel the connection.