This commit is contained in:
世界 2025-03-10 14:05:03 +08:00
parent ac322679e0
commit 171c52b1ed
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -21,7 +21,7 @@ import (
var _ net.Conn = (*GunConn)(nil) var _ net.Conn = (*GunConn)(nil)
type GunConn struct { type GunConn struct {
rd io.Reader rawReader io.Reader
reader *std_bufio.Reader reader *std_bufio.Reader
writer io.Writer writer io.Writer
flusher http.Flusher flusher http.Flusher
@ -32,10 +32,10 @@ type GunConn struct {
func newGunConn(reader io.Reader, writer io.Writer, flusher http.Flusher) *GunConn { func newGunConn(reader io.Reader, writer io.Writer, flusher http.Flusher) *GunConn {
return &GunConn{ return &GunConn{
rd: reader, rawReader: reader,
reader: std_bufio.NewReader(reader), reader: std_bufio.NewReader(reader),
writer: writer, writer: writer,
flusher: flusher, flusher: flusher,
} }
} }
@ -48,7 +48,7 @@ func newLateGunConn(writer io.Writer) *GunConn {
func (c *GunConn) setup(reader io.Reader, err error) { func (c *GunConn) setup(reader io.Reader, err error) {
if reader != nil { if reader != nil {
c.rd = reader c.rawReader = reader
c.reader = std_bufio.NewReader(reader) c.reader = std_bufio.NewReader(reader)
} }
c.err = err c.err = err
@ -141,7 +141,7 @@ func (c *GunConn) FrontHeadroom() int {
} }
func (c *GunConn) Close() error { func (c *GunConn) Close() error {
return common.Close(c.rd, c.writer) return common.Close(c.rawReader, c.writer)
} }
func (c *GunConn) LocalAddr() net.Addr { func (c *GunConn) LocalAddr() net.Addr {