sofastack / sofa-rpc

SOFARPC is a high-performance, high-extensibility, production-level Java RPC framework.
https://www.sofastack.tech/sofa-rpc/docs/Home
Apache License 2.0
3.81k stars 1.17k forks source link

Confuse on the logic judge isRandomPort and the comment note | 随机端口判断的逻辑和注释容易混淆 #1256

Closed jnan806 closed 1 year ago

jnan806 commented 1 year ago

Describe the bug

file-location : sofa-rpc/core/api/src/main/java/com/alipay/sofa/rpc/common/utils/NetUtils.java function : public static boolean isRandomPort(int port)

logic in isRandomPort() is conflict with the comment, so which is the correct ? the logic or the comment ?

image

Expected behavior

Actual behavior

Steps to reproduce

Minimal yet complete reproducer code (or GitHub URL to code)

Environment

EvenLjj commented 1 year ago

@jnan806 A precondition is that the port is between - 1 and 65535. Therefore, the comment that is less than 0 actually refers to - 1 too. Look very carefullyl. If you are interested, you can submit PR to modify this comment.

jnan806 commented 1 year ago

@jnan806 A precondition is that the port is between - 1 and 65535. Therefore, the comment that is less than 0 actually refers to - 1 too. Look very carefullyl. If you are interested, you can submit PR to modify this comment.

glad to contribute it. Please assign it to me ?

EvenLjj commented 1 year ago

@jnan806 Okay, look forward to more participation.

jnan806 commented 1 year ago

@EvenLjj PR has been submitted. And need an approval to run the workflow.