Yes, the problem is that `withTimeout` doesn't cancel the dataEvt future. So it 
continues running even though the timeout occurred, eventually reads the data 
and loses it since the withTimeout has long disappeared.

Yep, this is horrible but sadly async in Nim doesn't yet support cancelling 
futures :/. We might have to put a big warning on `withTimeout` to watch out 
for this until we get that support.

In order to give you a workaround I need to ask: why are you doing this? Is it 
because you want to add code which disconnects the client if it doesn't send 
data in a certain amount of time? (if so, you should just create a 
processClientPings async proc and call it in the background with asyncCheck as 
well, closing a socket that is awaiting on a read in another async proc is 
safe). 

Reply via email to