Fix: fake non-blocking read adaptive wait time

If the time reached the minimum time before the 5 tries were up it
would get stuck reading 1 byte at a time indefinitely.
tmp-nbconn-win
Jack Christensen 2023-02-25 16:45:34 -06:00
parent 38e09bda4c
commit 8f46c75e73
1 changed files with 1 additions and 1 deletions

View File

@ -419,7 +419,7 @@ func (c *NetConn) fakeNonblockingRead(b []byte) (n int, err error) {
// The first 5 reads only read 1 byte at a time. This should give us 4 chances to read when we are sure the bytes are
// already in Go or the OS's receive buffer.
if c.fakeNonBlockingShortReadCount < 5 && len(b) > 0 {
if c.fakeNonBlockingShortReadCount < 5 && len(b) > 0 && c.fakeNonblockingReadWaitDuration < minNonblockingReadWaitDuration {
b = b[:1]
}