Documentation ¶
Overview ¶
https://github.com/flyaways/pool/blob/master/pool_tcp.go https://github.com/fatih/pool/blob/master/channel.go https://github.com/redis/go-redis
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBadConn = errors.New("tcpool: bad connection") ErrGetConnFailed = errors.New("tcpool: get conn failed,max retry times") )
Functions ¶
Types ¶
type ConnTrace ¶
type ConnTrace struct { // GetConn is called before a connection is created or // retrieved from an idle pool. The hostPort is the // "host:port" of the target or proxy. GetConn is called even // if there's already an idle cached connection available. GetConn func(hostPort string) // GotConn is called after a successful connection is // obtained. There is no hook for failure to obtain a // connection; instead, use the error from // Transport.RoundTrip. GotConn func(GotConnInfo) // PutIdleConn is called when the connection is returned to // the idle pool. If err is nil, the connection was // successfully returned to the idle pool. If err is non-nil, // it describes why not. PutIdleConn is not called if // connection reuse is disabled via Transport.DisableKeepAlives. // PutIdleConn is called before the caller's Response.Body.Close // call returns. // For HTTP/2, this hook is not currently used. PutIdleConn func(err error) // ConnectStart is called when a new connection's Dial begins. // If net.Dialer.DualStack (IPv6 "Happy Eyeballs") support is // enabled, this may be called multiple times. ConnectStart func(network, addr string) // ConnectDone is called when a new connection's Dial // completes. The provided err indicates whether the // connection completed successfully. // If net.Dialer.DualStack ("Happy Eyeballs") support is // enabled, this may be called multiple times. ConnectDone func(network, addr string, err error) }
type GotConnInfo ¶
type GotConnInfo struct { // Conn is the connection that was obtained. It is owned by // the http.Transport and should not be read, written or // closed by users of ClientTrace. Conn net.Conn // Reused is whether this connection has been previously // used for another HTTP request. Reused bool // WasIdle is whether this connection was obtained from an // idle pool. WasIdle bool // IdleTime reports how long the connection was previously // idle, if WasIdle is true. IdleTime time.Duration }
Click to show internal directories.
Click to hide internal directories.