MCPcopy Index your code
hub / github.com/coder/coder / Dial

Method Dial

testutil/net.go:61–75  ·  view source on GitHub ↗
(ctx context.Context, a Addr)

Source from the content-addressed store, hash-verified

59}
60
61func (n *InProcNet) Dial(ctx context.Context, a Addr) (net.Conn, error) {
62 n.Lock()
63 defer n.Unlock()
64 l, ok := n.listeners[a]
65 if !ok {
66 return nil, xerrors.Errorf("nothing listening on %s", a)
67 }
68 x, y := net.Pipe()
69 select {
70 case <-ctx.Done():
71 return nil, ctx.Err()
72 case l.c <- x:
73 return y, nil
74 }
75}
76
77func newInProcListener(n *InProcNet, a Addr) *inProcListener {
78 return &inProcListener{

Callers 3

TestPortForwardFunction · 0.95
TestServer_X11Function · 0.95

Calls 5

ErrMethod · 0.80
LockMethod · 0.45
UnlockMethod · 0.45
ErrorfMethod · 0.45
DoneMethod · 0.45

Tested by 3

TestPortForwardFunction · 0.76
TestServer_X11Function · 0.76