Skip to content

Commit e795f21

Browse files
committed
Fix client ConnectionRequestAccepted handling.
1 parent 539322e commit e795f21

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

raknet/src/main/java/com/nukkitx/network/raknet/RakNetClientSession.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,14 @@ private void onOpenConnectionReply2(ByteBuf buffer) {
155155
}
156156

157157
private void onConnectionRequestAccepted(ByteBuf buffer) {
158-
InetSocketAddress address = NetworkUtils.readAddress(buffer);
159-
int systemIndex = buffer.readUnsignedShort();
160-
while (buffer.isReadable(16)) {
158+
NetworkUtils.readAddress(buffer); // our address
159+
buffer.readUnsignedShort(); // system index
160+
final int required = (this.address.getAddress() instanceof Inet6Address ? IPV6_MESSAGE_SIZE : IPV4_MESSAGE_SIZE) + 16;
161+
while (buffer.isReadable(required)) {
161162
NetworkUtils.readAddress(buffer);
162163
}
163164
long pongTime = buffer.readLong();
165+
buffer.readLong();
164166

165167
this.sendNewIncomingConnection(pongTime);
166168

0 commit comments

Comments
 (0)