MCPcopy
hub / github.com/cloudflare/tableflip / Conn

Method Conn

fds.go:284–302  ·  view source on GitHub ↗

Conn returns an inherited connection or nil. It is safe to close the returned Conn.

(network, addr string)

Source from the content-addressed store, hash-verified

282//
283// It is safe to close the returned Conn.
284func (f *Fds) Conn(network, addr string) (net.Conn, error) {
285 f.mu.Lock()
286 defer f.mu.Unlock()
287
288 key := fileName{connKind, network, addr}
289 file := f.inherited[key]
290 if file == nil {
291 return nil, nil
292 }
293
294 conn, err := net.FileConn(file.File)
295 if err != nil {
296 return nil, fmt.Errorf("can't inherit connection %s %s: %s", network, addr, err)
297 }
298
299 delete(f.inherited, key)
300 f.used[key] = file
301 return conn, nil
302}
303
304// AddConn adds a connection.
305//

Callers 1

TestFdsConnFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestFdsConnFunction · 0.36