http trunk bug

This commit is contained in:
刘河
2019-04-12 17:40:27 +08:00
parent 4831e17b38
commit c01c61fc6b
2 changed files with 22 additions and 16 deletions

View File

@@ -384,3 +384,17 @@ func GetConn(conn net.Conn, cpt, snappy bool, rt *rate.Rate, isServer bool) (io.
}
return rate.NewRateConn(conn, rt)
}
type LenConn struct {
conn io.Writer
Len int
}
func NewLenConn(conn io.Writer) *LenConn {
return &LenConn{conn: conn}
}
func (c *LenConn) Write(p []byte) (n int, err error) {
n, err = c.conn.Write(p)
c.Len += n
return
}