diff --git a/pom.xml b/pom.xml index 4b201fe3..0f1f8006 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.steveice10 packetlib - 1.7-SNAPSHOT + 1.7 jar PacketLib diff --git a/src/main/java/com/github/steveice10/packetlib/tcp/TcpClientSession.java b/src/main/java/com/github/steveice10/packetlib/tcp/TcpClientSession.java index 85191d25..873fb02b 100644 --- a/src/main/java/com/github/steveice10/packetlib/tcp/TcpClientSession.java +++ b/src/main/java/com/github/steveice10/packetlib/tcp/TcpClientSession.java @@ -29,7 +29,6 @@ import io.netty.resolver.dns.DnsNameResolver; import io.netty.resolver.dns.DnsNameResolverBuilder; import java.net.InetSocketAddress; -import java.net.SocketAddress; public class TcpClientSession extends TcpSession { private Client client; @@ -111,7 +110,8 @@ public class TcpClientSession extends TcpSession { @Override public void run() { try { - bootstrap.remoteAddress(resolveAddress()); + resolveAddress(); + bootstrap.remoteAddress(getHost(), getPort()); ChannelFuture future = bootstrap.connect().sync(); if(future.isSuccess()) { @@ -138,7 +138,7 @@ public class TcpClientSession extends TcpSession { } } - private SocketAddress resolveAddress() { + private void resolveAddress() { boolean debug = getFlag(BuiltinFlags.PRINT_DEBUG, false); String name = this.getPacketProtocol().getSRVRecordPrefix() + "._tcp." + this.getHost(); @@ -168,7 +168,8 @@ public class TcpClientSession extends TcpSession { System.out.println("[PacketLib] Found SRV record containing \"" + host + ":" + port + "\"."); } - return new InetSocketAddress(host, port); + this.host = host; + this.port = port; } else if(debug) { System.out.println("[PacketLib] Received non-SRV record in response."); } @@ -185,8 +186,6 @@ public class TcpClientSession extends TcpSession { envelope.release(); } } - - return new InetSocketAddress(this.getHost(), this.getPort()); } @Override diff --git a/src/main/java/com/github/steveice10/packetlib/tcp/TcpSession.java b/src/main/java/com/github/steveice10/packetlib/tcp/TcpSession.java index f8dba5ca..e5f1347b 100644 --- a/src/main/java/com/github/steveice10/packetlib/tcp/TcpSession.java +++ b/src/main/java/com/github/steveice10/packetlib/tcp/TcpSession.java @@ -34,8 +34,8 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.LinkedBlockingQueue; public abstract class TcpSession extends SimpleChannelInboundHandler implements Session { - private String host; - private int port; + protected String host; + protected int port; private PacketProtocol protocol; private int compressionThreshold = -1;