GopherRequest: Don't wait for socket to be readable

Instead we can trigger a Read() immediately, as our socket is blocking
and won't return until some data has been made available. This avoids a
potentially costly syscall in the loop body.

Change-Id: I899f55ede41af7cb7e9311aa04006b33c40d3ee4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3076
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Leorize
2020-07-25 18:13:20 +00:00
committed by waddlesplash
parent d64d305cf6
commit 0d0f613f17
@@ -272,7 +272,6 @@ BGopherRequest::_ProtocolLoop()
BStackOrHeapArray<char, 4096> chunk(kGopherBufferSize);
while (!fQuit && !receiveEnd) {
fSocket->WaitForReadable();
bytesRead = fSocket->Read(chunk, kGopherBufferSize);
if (bytesRead < 0) {