mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net: refactor poller into new internal/poll package
This will make it possible to use the poller with the os package. This is a lot of code movement but the behavior is intended to be unchanged. Update #6817. Update #7903. Update #15021. Update #18507. Change-Id: I1413685928017c32df5654ded73a2643820977ae Reviewed-on: https://go-review.googlesource.com/36799 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
b548eee3d9
commit
3792db5183
79 changed files with 2722 additions and 1619 deletions
|
|
@ -7,6 +7,7 @@ package net
|
|||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"internal/poll"
|
||||
"internal/testenv"
|
||||
"io"
|
||||
"net/internal/socktest"
|
||||
|
|
@ -94,7 +95,7 @@ func TestDialTimeoutFDLeak(t *testing.T) {
|
|||
default:
|
||||
sw.Set(socktest.FilterConnect, func(so *socktest.Status) (socktest.AfterFilter, error) {
|
||||
time.Sleep(2 * T)
|
||||
return nil, errTimeout
|
||||
return nil, poll.ErrTimeout
|
||||
})
|
||||
defer sw.Set(socktest.FilterConnect, nil)
|
||||
}
|
||||
|
|
@ -585,8 +586,8 @@ func TestDialerPartialDeadline(t *testing.T) {
|
|||
{now, noDeadline, 1, noDeadline, nil},
|
||||
// Step the clock forward and cross the deadline.
|
||||
{now.Add(-1 * time.Millisecond), now, 1, now, nil},
|
||||
{now.Add(0 * time.Millisecond), now, 1, noDeadline, errTimeout},
|
||||
{now.Add(1 * time.Millisecond), now, 1, noDeadline, errTimeout},
|
||||
{now.Add(0 * time.Millisecond), now, 1, noDeadline, poll.ErrTimeout},
|
||||
{now.Add(1 * time.Millisecond), now, 1, noDeadline, poll.ErrTimeout},
|
||||
}
|
||||
for i, tt := range testCases {
|
||||
deadline, err := partialDeadline(tt.now, tt.deadline, tt.addrs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue