mirror of https://github.com/fatedier/frp.git
utils/vhost: update TcpConn with bufio.Reader
This commit is contained in:
parent
4f49458af0
commit
926d0b74a9
|
@ -117,6 +117,11 @@ func ConnectServer(host string, port int64) (c *Conn, err error) {
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Conn) SetTcpConn(tcpConn net.Conn) {
|
||||||
|
c.TcpConn = tcpConn
|
||||||
|
c.Reader = bufio.NewReader(c.TcpConn)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Conn) GetRemoteAddr() (addr string) {
|
func (c *Conn) GetRemoteAddr() (addr string) {
|
||||||
return c.TcpConn.RemoteAddr().String()
|
return c.TcpConn.RemoteAddr().String()
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ func (v *VhostMuxer) handle(c *conn.Conn) {
|
||||||
if err = sConn.SetDeadline(time.Time{}); err != nil {
|
if err = sConn.SetDeadline(time.Time{}); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.TcpConn = sConn
|
c.SetTcpConn(sConn)
|
||||||
|
|
||||||
l.accept <- c
|
l.accept <- c
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue