mirror of
https://github.com/openziti/ziti.git
synced 2026-10-19 10:21:41 +00:00
Merge pull request #534 from openziti/tunneler-udp-conn-leak
Fix UDP connection leak in tunneler
This commit is contained in:
@@ -19,11 +19,13 @@ package udp_vconn
|
||||
import (
|
||||
"github.com/openziti/foundation/util/mempool"
|
||||
"github.com/openziti/sdk-golang/ziti"
|
||||
"io"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
type UDPWriterTo interface {
|
||||
io.Closer
|
||||
WriteTo(b []byte, addr net.Addr) (int, error)
|
||||
LocalAddr() net.Addr
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/openziti/edge/tunnel"
|
||||
"github.com/openziti/foundation/util/mempool"
|
||||
"github.com/openziti/sdk-golang/ziti"
|
||||
"github.com/sirupsen/logrus"
|
||||
"io"
|
||||
"net"
|
||||
"time"
|
||||
@@ -137,6 +138,11 @@ func (manager *manager) close(conn *udpConn) {
|
||||
conn.closed = true
|
||||
delete(manager.connMap, conn.srcAddr.String())
|
||||
close(conn.readC)
|
||||
if err := conn.writeConn.Close(); err != nil {
|
||||
logrus.WithField("service", conn.service).
|
||||
WithField("src_addr", conn.srcAddr).
|
||||
WithError(err).Error("error while closing udp connection")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user