Skip to content

Commit

Permalink
Enable RakNet compatibility mode
Browse files Browse the repository at this point in the history
Fixes most RakNet connection issues
  • Loading branch information
RaphiMC committed Jul 24, 2024
1 parent 75d245f commit 6cd2510
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,19 @@ public void initialize(final ChannelType channelType, final Bootstrap bootstrap)
.channelFactory(RakChannelFactory.client(channelClass))
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 4_000)
.option(RakChannelOption.RAK_PROTOCOL_VERSION, ProtocolConstants.BEDROCK_RAKNET_PROTOCOL_VERSION)
.option(RakChannelOption.RAK_COMPATIBILITY_MODE, true)
.option(RakChannelOption.RAK_CLIENT_INTERNAL_ADDRESSES, 20)
.option(RakChannelOption.RAK_CONNECT_TIMEOUT, 4_000L)
.option(RakChannelOption.RAK_SESSION_TIMEOUT, 30_000L)
.option(RakChannelOption.RAK_GUID, ThreadLocalRandom.current().nextLong())
.attr(ProxyConnection.PROXY_CONNECTION_ATTRIBUTE_KEY, this)
.handler(this.channelInitializerSupplier.apply(this.handlerSupplier));

this.channelFuture = bootstrap.register().syncUninterruptibly();

/*if (this.getChannel().config().setOption(RakChannelOption.RAK_IP_DONT_FRAGMENT, true)) {
this.getChannel().config().setOption(RakChannelOption.RAK_MTU_SIZES, new Integer[]{1492, 1200, 576});
}*/
}

@Override
Expand Down

0 comments on commit 6cd2510

Please sign in to comment.