Skip to content

Commit

Permalink
fix: make netty injection less invasive
Browse files Browse the repository at this point in the history
  • Loading branch information
DrupalDoesNotExists committed Mar 30, 2024
1 parent 563dd49 commit 755ea61
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
public class PacketConstable {

private final ConcurrentLinkedQueue<PacketWindow> scheduledWindows = new ConcurrentLinkedQueue<>();
private PacketWindow lastWindow;

public PacketWindow getScheduledWindow() {
return scheduledWindows.peek();
}

public void schedule(PacketWindow window) {
PacketWindow end = getScheduledWindow();
if (window.kind() == PacketWindowKind.SINGLE && end.kind() == window.kind()) {
if (window.kind() == PacketWindowKind.SINGLE && lastWindow.kind() == window.kind()) {
// Stack singular windows as 1 object
window.size().addAndGet(window.size().get());
lastWindow.size().addAndGet(window.size().get());
} else {
// Otherwise, add a new object to the end
scheduledWindows.add(window);
lastWindow = window;
}
}

Expand Down

0 comments on commit 755ea61

Please sign in to comment.