Skip to content

Commit

Permalink
Make instance dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Sep 11, 2024
1 parent b67d76c commit 7f8affb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ default void switchInboundState(Runnable switcher) {
* @param switcher The runnable that switches the outbound state.
*/
default void switchOutboundState(Runnable switcher) {
getChannel().writeAndFlush(FakeFlushPacket.INSTANCE).syncUninterruptibly();
getChannel().writeAndFlush(new FakeFlushPacket()).syncUninterruptibly();

switcher.run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@
* Packet only exists to be writeAndFlushed to ensure all packets that came before are encoded and written out.
*/
public class FakeFlushPacket implements Packet {
public static final FakeFlushPacket INSTANCE = new FakeFlushPacket();

private FakeFlushPacket() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public TcpPacketCodec(Session session, boolean client) {
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void encode(ChannelHandlerContext ctx, Packet packet, ByteBuf buf) {
if (packet == FakeFlushPacket.INSTANCE) {
if (packet instanceof FakeFlushPacket) {
log.debug("Fake flush packet reached");
return;
}
Expand Down

0 comments on commit 7f8affb

Please sign in to comment.