-
-
Notifications
You must be signed in to change notification settings - Fork 572
Description
Canceling send() is discouraged. Instead, you should close the connection with close(). Indeed, there only two situations where send() yields control to the event loop:
The write buffer is full. If you don’t want to wait until enough data is sent, your only alternative is to close the connection.close() will likely time out then abort the TCP connection.
message is an asynchronous iterator. Stopping in the middle of a fragmented message will cause a protocol error. Closing the connection has the same effect.
It seems then that you actually would have to poll recv with wait_for in order to bubble up the connection-closing exception condition. Why is that?
Currently you can just continue successfully awaiting send despite the peer clearly and detectably trying to close the connection. This is a bug.