Fix direct connection and ensure connecting doesn't block

This commit is contained in:
Camotoy 2022-06-05 18:38:29 -04:00
parent bcc68ee4b5
commit 09fb6bf3ba
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
2 changed files with 3 additions and 3 deletions

View file

@ -58,7 +58,7 @@ public final class LocalSession extends TcpSession {
} }
@Override @Override
public void connect() { public void connect(boolean wait) {
if (this.disconnected) { if (this.disconnected) {
throw new IllegalStateException("Connection has already been disconnected."); throw new IllegalStateException("Connection has already been disconnected.");
} }

View file

@ -845,7 +845,7 @@ public class GeyserSession implements GeyserConnection, CommandSender {
// We're going to connect through the JVM and not through TCP // We're going to connect through the JVM and not through TCP
downstream = new LocalSession(this.remoteAddress, this.remotePort, downstream = new LocalSession(this.remoteAddress, this.remotePort,
geyser.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress(), geyser.getBootstrap().getSocketAddress(), upstream.getAddress().getAddress().getHostAddress(),
this.protocol, this.downstream.getCodecHelper()); this.protocol, this.protocol.createHelper());
} else { } else {
downstream = new TcpClientSession(this.remoteAddress, this.remotePort, this.protocol); downstream = new TcpClientSession(this.remoteAddress, this.remotePort, this.protocol);
disableSrvResolving(); disableSrvResolving();
@ -1017,7 +1017,7 @@ public class GeyserSession implements GeyserConnection, CommandSender {
setDaylightCycle(true); setDaylightCycle(true);
} }
downstream.connect(); downstream.connect(false);
} }
public void disconnect(String reason) { public void disconnect(String reason) {