more accurate source id

pull/215/head
v2ray 2016-07-10 15:58:55 +02:00
parent 30041041d3
commit 636effbe38
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 4 additions and 4 deletions

View File

@ -59,10 +59,10 @@ func (this *Listener) OnReceive(payload *alloc.Buffer, src v2net.Destination) {
if !this.running { if !this.running {
return return
} }
srcAddrStr := src.NetAddr() conv := serial.BytesToUint16(payload.Value)
conn, found := this.sessions[srcAddrStr] sourceId := src.NetAddr() + "|" + serial.Uint16ToString(conv)
conn, found := this.sessions[sourceId]
if !found { if !found {
conv := serial.BytesToUint16(payload.Value)
writer := &Writer{ writer := &Writer{
hub: this.hub, hub: this.hub,
dest: src, dest: src,
@ -79,7 +79,7 @@ func (this *Listener) OnReceive(payload *alloc.Buffer, src v2net.Destination) {
conn.Close() conn.Close()
return return
} }
this.sessions[srcAddrStr] = conn this.sessions[sourceId] = conn
} }
conn.Input(payload.Value) conn.Input(payload.Value)
} }