MCPcopy Create free account
hub / github.com/SamNet-dev/snix / halfCloseWrite

Function halfCloseWrite

core/relay/tcp.go:150–156  ·  view source on GitHub ↗

halfCloseWrite attempts a CloseWrite on TCP conns so the peer sees EOF cleanly. For non-TCP conns it falls back to Close.

(c net.Conn)

Source from the content-addressed store, hash-verified

148// halfCloseWrite attempts a CloseWrite on TCP conns so the peer sees EOF
149// cleanly. For non-TCP conns it falls back to Close.
150func halfCloseWrite(c net.Conn) error {
151 type closeWriter interface{ CloseWrite() error }
152 if cw, ok := c.(closeWriter); ok {
153 return cw.CloseWrite()
154 }
155 return c.Close()
156}
157
158// Listener is a thin wrapper that applies relay-friendly TCP socket options.
159// Individual platform backends may replace it with one that also installs

Callers 1

RunFunction · 0.85

Calls 2

CloseWriteMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected