1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00

fix memory leak

This commit is contained in:
v2ray 2016-07-12 18:27:14 +02:00
parent b9bf419f57
commit 9434f5156c
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -64,6 +64,7 @@ func (this *Listener) OnReceive(payload *alloc.Buffer, src v2net.Destination) {
conn, found := this.sessions[sourceId]
if !found {
writer := &Writer{
id: sourceId,
hub: this.hub,
dest: src,
listener: this,
@ -135,6 +136,7 @@ func (this *Listener) Addr() net.Addr {
}
type Writer struct {
id string
dest v2net.Destination
hub *udp.UDPHub
listener *Listener
@ -145,7 +147,7 @@ func (this *Writer) Write(payload []byte) (int, error) {
}
func (this *Writer) Close() error {
this.listener.Remove(this.dest.NetAddr())
this.listener.Remove(this.id)
return nil
}