Merge branch 'fix/message-composer' into 'dev'

Fix MessageComposer race condition caused by #133.

See merge request morningstar/Arcturus-Community!135
This commit is contained in:
Beny 2020-05-02 20:11:12 -04:00
commit f979901a6d
3 changed files with 1 additions and 20 deletions

View File

@ -89,7 +89,7 @@ public class GameClient {
public void sendResponse(MessageComposer composer) { public void sendResponse(MessageComposer composer) {
if (this.channel.isOpen()) { if (this.channel.isOpen()) {
try { try {
this.channel.write(composer, this.channel.voidPromise()); this.channel.write(composer.compose(), this.channel.voidPromise());
this.channel.flush(); this.channel.flush();
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logPacketError(e); Emulator.getLogging().logPacketError(e);

View File

@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClientManager;
import com.eu.habbo.messages.PacketManager; import com.eu.habbo.messages.PacketManager;
import com.eu.habbo.networking.Server; import com.eu.habbo.networking.Server;
import com.eu.habbo.networking.gameserver.decoders.*; import com.eu.habbo.networking.gameserver.decoders.*;
import com.eu.habbo.networking.gameserver.encoders.MessageComposerEncoder;
import com.eu.habbo.networking.gameserver.encoders.ServerMessageEncoder; import com.eu.habbo.networking.gameserver.encoders.ServerMessageEncoder;
import com.eu.habbo.networking.gameserver.encoders.GameServerMessageLogger; import com.eu.habbo.networking.gameserver.encoders.GameServerMessageLogger;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
@ -46,8 +45,6 @@ public class GameServer extends Server {
if (PacketManager.DEBUG_SHOW_PACKETS) { if (PacketManager.DEBUG_SHOW_PACKETS) {
ch.pipeline().addLast(new GameServerMessageLogger()); ch.pipeline().addLast(new GameServerMessageLogger());
} }
ch.pipeline().addLast(new MessageComposerEncoder());
} }
}); });
} }

View File

@ -1,16 +0,0 @@
package com.eu.habbo.networking.gameserver.encoders;
import com.eu.habbo.messages.outgoing.MessageComposer;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;
import java.util.List;
public class MessageComposerEncoder extends MessageToMessageEncoder<MessageComposer> {
@Override
protected void encode(ChannelHandlerContext ctx, MessageComposer message, List<Object> out) throws Exception {
out.add(message.compose());
}
}