NATMap: allow -b 0 to retain port if still available#129
Closed
ragingbulld wants to merge 1 commit intoheiher:mainfrom
Closed
NATMap: allow -b 0 to retain port if still available#129ragingbulld wants to merge 1 commit intoheiher:mainfrom
ragingbulld wants to merge 1 commit intoheiher:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-b 0的时候使用bind()函数来随机分配一个可用端口
绕过了hev_conf_bport (int next)函数来切换端口
当-b 0时通过hev_conf.c手动设置bport[0]=1,bport[1]=65535,brand =1;然后通过hev_conf_bport函数随机生成一个1~65535内的一个端口这样受到next变量影响不会在下次绑定的时候切换端口
虽然无法做到bind函数选择一个没有被占用的端口,但是当随机分配到一个被占用的端口时会自动切换端口,保留了当端口可用时不切换端口的能力
代码水平有限,不知可有更好的方案?