Skip to content

Commit

Permalink
[#7365] Fix getting localAddress when SocketChannel state is connecting
Browse files Browse the repository at this point in the history
  • Loading branch information
koo-taejin committed Nov 24, 2020
1 parent a113e52 commit f793813
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -28,7 +28,6 @@
import org.apache.kafka.clients.ClientResponse;
import org.apache.kafka.common.requests.FetchResponse;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.channels.SocketChannel;
Expand Down Expand Up @@ -96,7 +95,6 @@ public void after(Object target, Object[] args, Object result, Throwable throwab

if (endPointFieldAccessor._$PINPOINT$_getEndPoint() == null) {
endPointFieldAccessor._$PINPOINT$_setEndPoint(endPointAddress);
endPointFieldAccessor._$PINPOINT$_setEndPoint(endPointAddress);
}
}

Expand All @@ -114,11 +112,15 @@ private String getEndPointAddressString(SocketChannelListFieldAccessor socketCha
List<String> endPointAddressList = new ArrayList<String>(socketChannels.size());
for (SocketChannel socketChannel : socketChannels) {
try {
if (!socketChannel.isConnected()) {
continue;
}

SocketAddress localAddress = socketChannel.getLocalAddress();

String ipPort = getIpPort(localAddress);
endPointAddressList.add(ipPort);
} catch (IOException e) {
} catch (Exception e) {
}
}

Expand Down

0 comments on commit f793813

Please sign in to comment.