You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2022/07/15 01:20:33 UTC

[GitHub] [ratis] ChenSammi commented on a diff in pull request #663: RATIS-1605. Refactor MiniRaftCluster#addNewPeers.

ChenSammi commented on code in PR #663:
URL: https://github.com/apache/ratis/pull/663#discussion_r921728948


##########
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java:
##########
@@ -167,7 +168,14 @@ public void closeImpl() throws IOException {
 
   @Override
   public InetSocketAddress getInetSocketAddress() {
-    return (InetSocketAddress)getChannel().localAddress();
+    try {
+      return (InetSocketAddress) getChannel().localAddress();
+    } catch (IllegalStateException e) {
+      if (socketAddress.getPort() != NettyConfigKeys.Server.PORT_DEFAULT) {
+        return socketAddress;
+      }

Review Comment:
   Because if the port is PORT_DEFAULT which is 0, it's not a real port, cannot be returned to construct the RaftPeer object.  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org