diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-01-27 23:33:44 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-01-27 23:33:44 +0000 |
commit | 39fc573e80eca187af64379bbf178da39a94cd29 (patch) | |
tree | c5bedfd3cc21fc67f36e1b1d5de14fb89ac5cfd4 /pkg | |
parent | 9cb3422cf9c2116cd8288ef8b26d323c4ec33e5e (diff) | |
parent | 60d7ff73e1a788749d76fc9402836ae3a04053a8 (diff) |
Merge release-20200115.0-109-g60d7ff7 (automated)
Diffstat (limited to 'pkg')
-rwxr-xr-x | pkg/tcpip/adapters/gonet/gonet.go | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/pkg/tcpip/adapters/gonet/gonet.go b/pkg/tcpip/adapters/gonet/gonet.go index 3bba4028b..711969b9b 100755 --- a/pkg/tcpip/adapters/gonet/gonet.go +++ b/pkg/tcpip/adapters/gonet/gonet.go @@ -556,6 +556,17 @@ type PacketConn struct { wq *waiter.Queue } +// NewPacketConn creates a new PacketConn. +func NewPacketConn(s *stack.Stack, wq *waiter.Queue, ep tcpip.Endpoint) *PacketConn { + c := &PacketConn{ + stack: s, + ep: ep, + wq: wq, + } + c.deadlineTimer.init() + return c +} + // DialUDP creates a new PacketConn. // // If laddr is nil, a local address is automatically chosen. @@ -580,12 +591,7 @@ func DialUDP(s *stack.Stack, laddr, raddr *tcpip.FullAddress, network tcpip.Netw } } - c := PacketConn{ - stack: s, - ep: ep, - wq: &wq, - } - c.deadlineTimer.init() + c := NewPacketConn(s, &wq, ep) if raddr != nil { if err := c.ep.Connect(*raddr); err != nil { @@ -599,7 +605,7 @@ func DialUDP(s *stack.Stack, laddr, raddr *tcpip.FullAddress, network tcpip.Netw } } - return &c, nil + return c, nil } func (c *PacketConn) newOpError(op string, err error) *net.OpError { |