mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 09:50:51 +01:00
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:
commit
f979901a6d
@ -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);
|
||||||
|
@ -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());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user