pkg/transport/timeout_listener.go
func NewTimeoutListener(addr string, scheme string, tlsinfo *TLSInfo, rdtimeoutd, wtimeoutd time.Duration) (net.Listener, error) {
	ln, err := newListener(addr, scheme)
	if err != nil {
		return nil, err
	}
	ln = &rwTimeoutListener{
		Listener:   ln,
		rdtimeoutd: rdtimeoutd,
		wtimeoutd:  wtimeoutd,
	}
	if ln, err = wrapTLS(scheme, tlsinfo, ln); err != nil {
		return nil, err
	}
	return ln, nil
}
func NewTimeoutListener(addr string, scheme string, tlsinfo *TLSInfo, rdtimeoutd, wtimeoutd time.Duration) (net.Listener, error) {
	ln, err := newListener(addr, scheme)
	if err != nil {
		return nil, err
	}
	ln = &rwTimeoutListener{
		Listener:   ln,
		rdtimeoutd: rdtimeoutd,
		wtimeoutd:  wtimeoutd,
	}
	if ln, err = wrapTLS(scheme, tlsinfo, ln); err != nil {
		return nil, err
	}
	return ln, nil
}
func NewTimeoutListener ( addr string , scheme string , tlsinfo * TLSInfo , rdtimeoutd , wtimeoutd time . Duration ) ( net . Listener , error ) { ln , err := newListener ( addr , scheme ) if err != nil { return nil , err } ln = & rwTimeoutListener { Listener : ln , rdtimeoutd : rdtimeoutd , wtimeoutd : wtimeoutd , } if ln , err = wrapTLS ( scheme , tlsinfo , ln ) ; err != nil { return nil , err } return ln , nil }
// NewTimeoutListener returns a listener that listens on the given address.
// If read/write on the accepted connection blocks longer than its time limit,
// it will return timeout error.
NewTimeoutListener returns a listener that listens on the given address . If read / write on the accepted connection blocks longer than its time limit it will return timeout error .