Do not wait on rx_task and tx_task when closing the socket. #1896
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When loosing the connection to a peer, if the send buffer happens to fill up before the keep alive timeout, the tx_task can be stuck in the
send_batch
operation. On my computer, it can be stuck for 15 minutes before returning with EHOSTUNREACH ("No route to host").Now this is not that bat itself, it's just a dangling task,
TransportLinkUnicastUniversal
andTransportUnicastUniversal
. But this make the race condition mentionned in #1886 very likely: if the peer reconnect within those 15 minutes, the reconnection is bogus.This "fix" make
TransportLinkUnicastUniversal::close()
not wait for the rx and tx task before returning. It doesn't seem to cause any issue. I didn't do the same inTransportUnicastLowlatency
because I am not sure it is necessary.Now I am not really happy with this hack, but I would like to have a solution for #1886 and it's a bit too involved for me alone.
An alternative would be to watch for the cancellation token while calling
send_batch
.