After dispatcher.Stop is called, dispatcher.DeleteClient will block.
Since we give up control over when onClientConnected/Disconnected are called, we need to first signal not to call DeleteClient anymore (stopped chan struct{}) and wait until any in progress calls are finished, then we can call Stop.
After
dispatcher.Stop
is called,dispatcher.DeleteClient
will block. Since we give up control over whenonClientConnected/Disconnected
are called, we need to first signal not to callDeleteClient
anymore (stopped chan struct{}
) and wait until any in progress calls are finished, then we can callStop
.This is one solution at least.