소스 검색

pick truely unused port

v2ray 9 년 전
부모
커밋
464f15cb02
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      shell/point/inbound_detour_dynamic.go

+ 3 - 1
shell/point/inbound_detour_dynamic.go

@@ -91,9 +91,11 @@ func (this *InboundDetourHandlerDynamic) refresh() error {
 
 	this.ich2Recycle, this.ichInUse = this.ichInUse, this.ich2Recycle
 	for _, ich := range this.ichInUse {
+		port := this.pickUnusedPort()
+
 		delete(this.portsInUse, ich.Port())
 		ich.Close()
-		port := this.pickUnusedPort()
+
 		err := retry.Timed(100 /* times */, 100 /* ms */).On(func() error {
 			err := ich.Listen(port)
 			if err != nil {