Close being called using `withTimeout` seems to work as expected. This issue 
seems to stem from when the `close` call is being made, and from where. This 
still presents the issue of closing clients later by force, but maybe it's a 
nothingburger. Still, does anyone have any ideas why the way I call `close` 
hangs everything?

Here is the code using `withTimeout` in the `initClientAndLoop` which works:
    
    
    echo "Receiving..."
    let fut = conn.recv(5)
    if await withTimeout(fut, IDLE_TIMEOUT):
        let res = await fut
        echo fmt"Received {res.len} bytes"
        if res == "quit\n":
            conn.close()
            echo (await conn.recv(1)).len
            break
    else:
        echo "Timed out"
        conn.close()
        return
    
    
    Run

Reply via email to