Skip to content

Commit a09d0fd

Browse files
authored
Sync the future on wait (GeyserMC#43)
1 parent 50b53e8 commit a09d0fd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/java/com/github/steveice10/packetlib/tcp/TcpClientSession.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,14 @@ public void initChannel(Channel channel) {
129129
bootstrap.remoteAddress(remoteAddress);
130130
bootstrap.localAddress(bindAddress, bindPort);
131131

132-
bootstrap.connect().addListener((future) -> {
133-
if (!future.isSuccess()) {
134-
exceptionCaught(null, future.cause());
132+
ChannelFuture future = bootstrap.connect();
133+
if (wait) {
134+
future.sync();
135+
}
136+
137+
future.addListener((futureListener) -> {
138+
if (!futureListener.isSuccess()) {
139+
exceptionCaught(null, futureListener.cause());
135140
}
136141
});
137142
} catch(Throwable t) {

0 commit comments

Comments
 (0)