func newClientConn(rwc net.Conn, proxy *Proxy) *clientConn { buf := httpBuf.Get() c := &clientConn{ Conn: rwc, serverConn: map[string]*serverConn{}, buf: buf, bufRd: bufio.NewReaderFromBuf(rwc, buf), proxy: proxy, } return c }
func newClientConn(cli net.Conn, proxy Proxy) *clientConn { buf := httpBuf.Get() c := &clientConn{ Conn: cli, buf: buf, bufRd: bufio.NewReaderFromBuf(cli, buf), proxy: proxy, } if debug { debug.Printf("cli(%s) connected, total %d clients\n", cli.RemoteAddr(), incCliCnt()) } return c }
func (sv *serverConn) initBuf() { if sv.bufRd == nil { sv.buf = httpBuf.Get() sv.bufRd = bufio.NewReaderFromBuf(sv, sv.buf) } }