try fix tcp not closed

addon-dailer
lqqyt2423 2 years ago
parent f52ced59bf
commit 6aab751610

@ -77,11 +77,11 @@ func (addon *LogAddon) ClientDisconnected(client *ClientConn) {
} }
func (addon *LogAddon) ServerConnected(connCtx *ConnContext) { func (addon *LogAddon) ServerConnected(connCtx *ConnContext) {
log.Infof("%v server connect %v (%v)\n", connCtx.ClientConn.Conn.RemoteAddr(), connCtx.ServerConn.Address, connCtx.ServerConn.Conn.RemoteAddr()) log.Infof("%v server connect %v (%v->%v)\n", connCtx.ClientConn.Conn.RemoteAddr(), connCtx.ServerConn.Address, connCtx.ServerConn.Conn.LocalAddr(), connCtx.ServerConn.Conn.RemoteAddr())
} }
func (addon *LogAddon) ServerDisconnected(connCtx *ConnContext) { func (addon *LogAddon) ServerDisconnected(connCtx *ConnContext) {
log.Infof("%v server disconnect %v (%v)\n", connCtx.ClientConn.Conn.RemoteAddr(), connCtx.ServerConn.Address, connCtx.ServerConn.Conn.RemoteAddr()) log.Infof("%v server disconnect %v (%v->%v)\n", connCtx.ClientConn.Conn.RemoteAddr(), connCtx.ServerConn.Address, connCtx.ServerConn.Conn.LocalAddr(), connCtx.ServerConn.Conn.RemoteAddr())
} }
func (addon *LogAddon) Requestheaders(f *Flow) { func (addon *LogAddon) Requestheaders(f *Flow) {

@ -235,7 +235,7 @@ func (c *wrapClientConn) Close() error {
if c.closed { if c.closed {
return c.closeErr return c.closeErr
} }
log.Debugln("in wrapClientConn close") log.Debugln("in wrapClientConn close", c.connCtx.ClientConn.Conn.RemoteAddr())
c.closed = true c.closed = true
c.closeErr = c.Conn.Close() c.closeErr = c.Conn.Close()
@ -245,7 +245,7 @@ func (c *wrapClientConn) Close() error {
} }
if c.connCtx.ServerConn != nil && c.connCtx.ServerConn.Conn != nil { if c.connCtx.ServerConn != nil && c.connCtx.ServerConn.Conn != nil {
c.connCtx.ServerConn.Conn.(*wrapServerConn).Conn.(*net.TCPConn).CloseRead() c.connCtx.ServerConn.Conn.Close()
} }
return c.closeErr return c.closeErr
@ -282,7 +282,7 @@ func (c *wrapServerConn) Close() error {
if c.closed { if c.closed {
return c.closeErr return c.closeErr
} }
log.Debugln("in wrapServerConn close") log.Debugln("in wrapServerConn close", c.connCtx.ClientConn.Conn.RemoteAddr())
c.closed = true c.closed = true
c.closeErr = c.Conn.Close() c.closeErr = c.Conn.Close()

Loading…
Cancel
Save