Skip to content

Commit

Permalink
fix: tuic pool client should only cache the system's UDPConn
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Apr 10, 2023
1 parent 9afcb70 commit 4d12ed4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions transport/tuic/pool_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ func (t *PoolClient) dial(ctx context.Context, dialer C.Dialer, dialFn DialFunc)
return nil, nil, err
}

dr.pc, dr.addr, dr.err = pc, addr, err
if _, ok := pc.(*net.UDPConn); ok { // only cache the system's UDPConn
dr.pc, dr.addr, dr.err = pc, addr, err

t.dialResultMutex.Lock()
t.dialResultMap[dialer] = dr
t.dialResultMutex.Unlock()
}

t.dialResultMutex.Lock()
t.dialResultMap[dialer] = dr
t.dialResultMutex.Unlock()
return pc, addr, err
}

Expand Down

0 comments on commit 4d12ed4

Please sign in to comment.