Skip to content

Commit fd65d1e

Browse files
authored
Fix Issues with Offline State (#49)
2 parents 9c66346 + edb9c5d commit fd65d1e

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

transport-raknet/src/main/java/org/cloudburstmc/netty/handler/codec/raknet/client/RakClientOfflineHandler.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,21 @@ public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
7676
}
7777

7878
private void onRetryAttempt(Channel channel) {
79-
switch (this.state) {
80-
case HANDSHAKE_1:
79+
if (this.rakChannel.config().getOption(RakChannelOption.RAK_COMPATIBILITY_MODE)) {
80+
if (this.state != RakOfflineState.HANDSHAKE_COMPLETED) {
8181
this.sendOpenConnectionRequest1(channel);
8282
this.connectionAttempts++;
83-
break;
84-
case HANDSHAKE_2:
85-
this.sendOpenConnectionRequest2(channel);
86-
break;
83+
}
84+
} else {
85+
switch (this.state) {
86+
case HANDSHAKE_1:
87+
this.sendOpenConnectionRequest1(channel);
88+
this.connectionAttempts++;
89+
break;
90+
case HANDSHAKE_2:
91+
this.sendOpenConnectionRequest2(channel);
92+
break;
93+
}
8794
}
8895
}
8996

@@ -158,6 +165,8 @@ private void onOpenConnectionReply1(ChannelHandlerContext ctx, ByteBuf buffer) {
158165
if (security) {
159166
this.cookie = buffer.readInt();
160167
this.security = true;
168+
} else {
169+
this.security = false;
161170
}
162171
int mtu = buffer.readShort();
163172

0 commit comments

Comments
 (0)