1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-25 00:45:24 +00:00

Lazy initialization of UDP ports map

This commit is contained in:
V2Ray 2015-09-30 21:31:05 +02:00
parent 2a4edde634
commit 365baa0c6a
2 changed files with 7 additions and 1 deletions

View File

@ -96,3 +96,7 @@ func (p *Point) DispatchToOutbound(packet v2net.Packet) InboundRay {
_ = och.Start(ray)
return ray
}
func (p *Point) DispatchToInbound(packet v2net.Packet) {
return
}

View File

@ -68,12 +68,14 @@ func (m *portMap) popPort(token uint16) *net.UDPAddr {
}
var (
ports = newPortMap()
ports *portMap
udpConn *net.UDPConn
)
func (server *SocksServer) ListenUDP(port uint16) error {
ports = newPortMap()
addr := &net.UDPAddr{
IP: net.IP{0, 0, 0, 0},
Port: int(port),