DaanHoogland commented on a change in pull request #2239: CLOUDSTACK-9993: 
Securing Agents Communications
URL: https://github.com/apache/cloudstack/pull/2239#discussion_r134431321
 
 

 ##########
 File path: 
engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
 ##########
 @@ -495,28 +495,29 @@ public SocketChannel connectToPeer(final String 
peerName, final SocketChannel pr
                 }
                 final String ip = ms.getServiceIP();
                 InetAddress addr;
+                int port = Port.value();
                 try {
                     addr = InetAddress.getByName(ip);
                 } catch (final UnknownHostException e) {
                     throw new CloudRuntimeException("Unable to resolve " + ip);
                 }
                 SocketChannel ch1 = null;
                 try {
-                    ch1 = SocketChannel.open(new InetSocketAddress(addr, 
Port.value()));
+                    ch1 = SocketChannel.open(new InetSocketAddress(addr, 
port));
 
 Review comment:
   SocketChannel is a Closable. We should reduce our proprietary error handling 
here and try-with-resource.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to