INNER CODE UNIT · Go

halfCloseIdleTimeout

docker/compose · relay/main.go:170

var halfCloseIdleTimeout = 60 * time.Second

// idleConn re-arms a read deadline before each Read once armed: active
// transfers never expire, idle ones do.
type idleConn struct {
	net.Conn
	armed atomic.Bool
}

func (c *idleConn) Read(p []byte) (int, error) {
	if c.armed.Load() {
		_ = c.SetReadDeadline(time.Now().Add(halfCloseIdleTimeout))
	}
	return c.Conn.Read(p)
}

// forward deliberately takes no context: a connection accepted at the
// shutdown boundary (context cancelled, listener not yet closed) must still

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…