diff options
| author | Mansour Rahimi <rahimi.mnr@gmail.com> | 2018-02-07 02:17:50 +0100 |
|---|---|---|
| committer | Mikio Hara <mikioh.mikioh@gmail.com> | 2018-02-21 10:40:03 +0000 |
| commit | 79fe895112dc3759506e57c519a2b38c41ee71dd (patch) | |
| tree | d7e59317975beebe68eac36133bc349747632baf /src/net/timeout_test.go | |
| parent | cab7ba0b28d65bcb1d2a02ec945f43625869172e (diff) | |
| download | go-79fe895112dc3759506e57c519a2b38c41ee71dd.tar.xz | |
net: fix UDPConn readers to return truncated payload size instead of 0
Calling UDPConn readers (Read, ReadFrom, ReadMsgUDP) to read part of
datagram returns error (in Windows), mentioning there is more data
available, and 0 as size of read data, even though part of data is
already read.
This fix makes UDPConn readers to return truncated payload size,
even there is error due more data available to read.
Fixes #14074
Updates #18056
Change-Id: Id7eec7f544dd759b2d970fa2561eef2937ec4662
Reviewed-on: https://go-review.googlesource.com/92475
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Diffstat (limited to 'src/net/timeout_test.go')
| -rw-r--r-- | src/net/timeout_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/timeout_test.go b/src/net/timeout_test.go index 9de7801ad1..0ecf5a6d25 100644 --- a/src/net/timeout_test.go +++ b/src/net/timeout_test.go @@ -482,7 +482,7 @@ func TestReadFromTimeout(t *testing.T) { time.Sleep(tt.timeout / 3) continue } - if n != 0 { + if nerr, ok := err.(Error); ok && nerr.Timeout() && n != 0 { t.Fatalf("#%d/%d: read %d; want 0", i, j, n) } break |
