The NetworkBehaviour maintains a map of NodeHandler but entries are never deleted from this map. Each NodeHandler maintains a goroutine to process events from other state machines that want to send messages to the node. Deleting an idle NodeHandler from the map is safe since its only state is the queue of events waiting to be processed.
A NodeHandler should be removed from the map when:
the node is removed from the routing table
no communication has been requested for a configurable period of time
When the NodeHandler is deleted the goroutine servicing its work queue should also be stopped.
The NetworkBehaviour maintains a map of NodeHandler but entries are never deleted from this map. Each NodeHandler maintains a goroutine to process events from other state machines that want to send messages to the node. Deleting an idle NodeHandler from the map is safe since its only state is the queue of events waiting to be processed.
A NodeHandler should be removed from the map when:
When the NodeHandler is deleted the goroutine servicing its work queue should also be stopped.