Commit d285b5a5 authored by Committed by Olivier CrêteBrowse files
agent: Always emit a readable callback when pseudo-TCP data arrives
Previously, the pseudo-TCP implementation’s readable() callback would only be invoked when new data was received if it was enabled. The callback is enabled by reading all data from the TCP input buffer until EWOULDBLOCK is returned. Reading all that data is not possible if the client buffer is of a limited size, and can lead to livelocks if the client reads exactly the number of bytes in the TCP input buffer (i.e. its buffer size matches the TCP buffer fill level). Instead, always invoke the readable() callback. This might be slightly less performant, but the whole pseudo-TCP implementation is a shambles anyway, and the callbacks need removing, so why not?