Skip to content

Commit

Permalink
Insert a short pseudorandom delay before closing channel after any as…
Browse files Browse the repository at this point in the history
…ymmetric decoding failure
  • Loading branch information
kevinherron committed Jul 31, 2024
1 parent 5e91195 commit 60c90b8
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

Expand Down Expand Up @@ -296,7 +297,11 @@ private void onOpenSecureChannel(ChannelHandlerContext ctx, ByteBuf buffer) thro
} catch (MessageDecodeException e) {
logger.error("Error decoding asymmetric message", e);

ctx.close();
ctx.executor().schedule(
() -> ctx.close(),
new Random().nextInt(1000), TimeUnit.MILLISECONDS
);

return;
}

Expand Down

0 comments on commit 60c90b8

Please sign in to comment.