f6ca40b4fd
The last burst of data arrives with POLLHUP. If during the read we hit any errors, including EAGAIN, for whatever reason, we may lose the data if we don't attempt reading again later. The only way to guarantee that we do not have any more data to read, when we get POLLHUP, is to poll until we either get no POLLIN or read returns 0 indicating the socket is closed, Oddly, read(2) sometimes returns 0 without POLLHUP ever being set, and sometimes we do get POLLHUP while POLLIN still set. This implies that poll and read aren't consistent in how they detect and report the close condition. Luckily, with this patch we can handle all cases without any complications. This was caught through simulateSocketError, which when it injects EAGAIN on the very last read, when the socket is closed, causes error as the response is partially or completely lost (because we never read it). The behavioral change should only be observable with EnableExperimental. Change-Id: I77260f98d5dd5050c5f9b202b9effd501191336b Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk> |
||
---|---|---|
.. | ||
Buffer.hpp | ||
clientnb.cpp | ||
DelaySocket.cpp | ||
DelaySocket.hpp | ||
FakeSocket.cpp | ||
FakeSocket.hpp | ||
HttpHelper.cpp | ||
HttpHelper.hpp | ||
HttpRequest.cpp | ||
HttpRequest.hpp | ||
NetUtil.cpp | ||
NetUtil.hpp | ||
ServerSocket.hpp | ||
Socket.cpp | ||
Socket.hpp | ||
Ssl.cpp | ||
Ssl.hpp | ||
SslSocket.hpp | ||
WebSocketHandler.hpp | ||
WebSocketSession.hpp |