janus-ftl-plugin icon indicating copy to clipboard operation
janus-ftl-plugin copied to clipboard

Pending writes are not flushed when a connection is closed

Open haydenmc opened this issue 4 years ago • 1 comments

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().

haydenmc avatar Feb 15 '21 08:02 haydenmc

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

danstiner avatar Mar 09 '21 16:03 danstiner