Conversation
- added new tryBind overloaded method for trying preffered port first
|
I'm a bit annoyed with the proposed patch... The idea was to be sure we can bind twice on the same address (host:port). Calling the Here, what seems to happen is that even if the I wonder if setting the SO_REUSEPORT wouldn't be a better solution. |
|
Nah, it's simpler that that. This part of the code recreate a socket address: Changing the code to: fixes the test. |
|
Nothing to be annoyed about, that's what PR and reviews are for. That is correct. So the idea of the test is to reuse the same pair "localhost" / port, but the port can be busy during the second attempt - that's what happened in the GH action. In the proposed patch we try to bind to the first one which can still fail, and if it does we fall back to the newly assigned port. So yes, at the end this is the "best effort" test and occasionally will attempt to bind to the same pair. |
Ok. So you proposed patch is doing something else. You always try a new port. The question is what was the intention of the original test (no comments and badly named test method). If reusing the same port is not crucial here than it is good patch. |
|
The original test was really testing we can re-bind after an unbind. Side note for myself: test every patch on Mac AND Linux... |
|
FTR, there is something fishy. The original code was: I changed it to be: The only difference is that the I suggest a modification of the wdyt? |
Yes, this is a good change. I was planning to add it, but I didn't want to go crazy with changes to util in single PR. |
|
I'll push the change then. |
|
Closing down. This is obsolete now. |
Might be worth merging via PR to trigger actions. |
I noticed that one test is still failing
https://github.com/apache/mina/actions/runs/36934956436
Changes
AcceptorBindUtilto try preferred port first if specifiedorg.apache.mina.transport.socket.nio.SocketAcceptorTest#testBindTwicefix