INNER CODE UNIT · Go

func

docker/compose · relay/main.go:179

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
// be served — that is the drain contract — and a cancelled context would make
// DialContext fail instantly. The dialer timeout bounds the dial instead.
func forward(downstream net.Conn, upstream string) {
	defer func() { _ = downstream.Close() }()
	dialer := net.Dialer{Timeout: 10 * time.Second}
	up, err := dialer.Dial("tcp", upstream)
	if err != nil {
		log.Printf("dial %s: %v", upstream, err)
		return

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…