소스 검색

fix race condition in shadowsocks

v2ray 9 년 전
부모
커밋
2d1ded9b9e
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      proxy/shadowsocks/shadowsocks.go

+ 1 - 1
proxy/shadowsocks/shadowsocks.go

@@ -74,13 +74,13 @@ func (this *Shadowsocks) Listen(port v2net.Port) error {
 	this.tcpHub = tcpHub
 
 	if this.config.UDP {
+		this.udpServer = hub.NewUDPServer(this.packetDispatcher)
 		udpHub, err := hub.ListenUDP(port, this.handlerUDPPayload)
 		if err != nil {
 			log.Error("Shadowsocks: Failed to listen UDP on port ", port, ": ", err)
 			return err
 		}
 		this.udpHub = udpHub
-		this.udpServer = hub.NewUDPServer(this.packetDispatcher)
 	}
 
 	return nil