diff options
author | Ian Gudger <igudger@google.com> | 2018-10-15 17:47:24 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-15 17:48:11 -0700 |
commit | 167f2401c4abb1ebda1f4536a04d9854e9008e0b (patch) | |
tree | dc9c7d33f0635039bf3ba45e912fb693f3a99812 /pkg/tcpip | |
parent | ecd94ea7a693d49a0edce8607241a8e2ac22bfe0 (diff) |
Merge host.endpoint into host.ConnectedEndpoint
host.endpoint contained duplicated logic from the sockerpair implementation and
host.ConnectedEndpoint. Remove host.endpoint in favor of a
host.ConnectedEndpoint wrapped in a socketpair end.
PiperOrigin-RevId: 217240096
Change-Id: I4a3d51e3fe82bdf30e2d0152458b8499ab4c987c
Diffstat (limited to 'pkg/tcpip')
-rw-r--r-- | pkg/tcpip/transport/unix/connectioned.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/tcpip/transport/unix/connectioned.go b/pkg/tcpip/transport/unix/connectioned.go index dd7c03cf1..e319b3bb8 100644 --- a/pkg/tcpip/transport/unix/connectioned.go +++ b/pkg/tcpip/transport/unix/connectioned.go @@ -158,6 +158,17 @@ func NewPair(stype SockType, uid UniqueIDProvider) (Endpoint, Endpoint) { return a, b } +// NewExternal creates a new externally backed Endpoint. It behaves like a +// socketpair. +func NewExternal(stype SockType, uid UniqueIDProvider, queue *waiter.Queue, receiver Receiver, connected ConnectedEndpoint) Endpoint { + return &connectionedEndpoint{ + baseEndpoint: baseEndpoint{Queue: queue, receiver: receiver, connected: connected}, + id: uid.UniqueID(), + idGenerator: uid, + stype: stype, + } +} + // ID implements ConnectingEndpoint.ID. func (e *connectionedEndpoint) ID() uint64 { return e.id |