소스 검색

Add SO_REUSEPORT to inbound

nullptr 6 년 전
부모
커밋
450bc5b3f0
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      transport/internet/sockopt_linux.go

+ 4 - 0
transport/internet/sockopt_linux.go

@@ -104,5 +104,9 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
 		}
 	}
 
+	if err := syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEPORT, 1); err != nil {
+		return newError("failed to set SO_REUSEPORT").Base(err).AtWarning()
+	}
+
 	return nil
 }