From 579d604ac617a1ad848acae12e94160783fb75ef Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Mon, 26 Sep 2016 17:38:50 +0200 Subject: [PATCH] getRemoteAddress doesn't work on Android (at least not KitKat), so let's get the address this way. --- .../dissem/bitmessage/networking/nio/NioNetworkHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/networking/src/main/java/ch/dissem/bitmessage/networking/nio/NioNetworkHandler.java b/networking/src/main/java/ch/dissem/bitmessage/networking/nio/NioNetworkHandler.java index 5800b38..f9fa06a 100644 --- a/networking/src/main/java/ch/dissem/bitmessage/networking/nio/NioNetworkHandler.java +++ b/networking/src/main/java/ch/dissem/bitmessage/networking/nio/NioNetworkHandler.java @@ -231,7 +231,11 @@ public class NioNetworkHandler implements NetworkHandler, InternalContext.Contex SocketChannel accepted = ((ServerSocketChannel) key.channel()).accept(); accepted.configureBlocking(false); ConnectionInfo connection = new ConnectionInfo(ctx, SERVER, - new NetworkAddress.Builder().address(accepted.getRemoteAddress()).stream(1).build(), + new NetworkAddress.Builder() + .ip(accepted.socket().getInetAddress()) + .port(accepted.socket().getPort()) + .stream(1) + .build(), requestedObjects, 0 ); connections.put(