mirror of
https://github.com/kubenetworks/kubevpn.git
synced 2025-12-24 11:51:13 +08:00
hotfix: close tcp conn after handle
This commit is contained in:
@@ -62,5 +62,13 @@ func (c *bufferedTCP) Run(ctx context.Context) {
|
||||
|
||||
func (c *bufferedTCP) Close() error {
|
||||
c.closed = true
|
||||
return c.Conn.Close()
|
||||
for {
|
||||
var buf *DatagramPacket
|
||||
select {
|
||||
case buf = <-c.Chan:
|
||||
config.LPool.Put(buf.Data[:])
|
||||
default:
|
||||
return c.Conn.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ func (h *gvisorTCPHandler) readFromEndpointWriteToTCPConn(ctx context.Context, c
|
||||
// tun --> dispatcher
|
||||
func (h *gvisorTCPHandler) readFromTCPConnWriteToEndpoint(ctx context.Context, conn net.Conn, endpoint *channel.Endpoint) {
|
||||
tcpConn, _ := newGvisorUDPConnOverTCP(ctx, conn)
|
||||
defer tcpConn.Close()
|
||||
defer h.removeFromRouteMapTCP(ctx, conn)
|
||||
|
||||
for ctx.Err() == nil {
|
||||
|
||||
Reference in New Issue
Block a user