janus-ftl-plugin
janus-ftl-plugin copied to clipboard
Pending writes are not flushed when a connection is closed
If you call NetworkSocketConnectionTransport::Write(...)
and then immediately NetworkSocketConnectionTransport::Stop()
, there's a good chance that the bytes you've just queued up to be written will not make it across the wire.
This is particularly unfortunate when you're trying to tell the client why you're about to disconnect them!
We ought to add a way to either synchronously write to a ConnectionTransport
, or flush writes when calling ConnectionTransport::Stop()
.
I thought surely there must be a flush call to make sure the bytes at least get out onto the wire...
No such luck! This article covers the relevant bits pretty well: https://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable