mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-27 02:40:51 +01:00
fix frozen packetlogger by giving option to skip big packets in logger (auto-enabled & with indication)
This commit is contained in:
parent
4154e935bc
commit
0d7c7b07ef
@ -26,6 +26,7 @@ public class UiLoggerController implements Initializable {
|
||||
public CheckMenuItem chkDisplayStructure;
|
||||
public Label lblAutoScrolll;
|
||||
public CheckMenuItem chkAutoscroll;
|
||||
public CheckMenuItem chkSkipBigPackets;
|
||||
|
||||
private StyleClassedTextArea area;
|
||||
|
||||
@ -33,6 +34,8 @@ public class UiLoggerController implements Initializable {
|
||||
private boolean viewOutgoing = true;
|
||||
private boolean displayStructure = true;
|
||||
private boolean autoScroll = true;
|
||||
private boolean skiphugepackets = true;
|
||||
|
||||
|
||||
private volatile boolean initialized = false;
|
||||
private final List<Element> appendLater = new ArrayList<>();
|
||||
@ -78,16 +81,27 @@ public class UiLoggerController implements Initializable {
|
||||
elements.add(new Element("]", "incoming"));
|
||||
|
||||
elements.add(new Element(" <- ", ""));
|
||||
elements.add(new Element(packet.toString(), "incoming"));
|
||||
if (skiphugepackets && packet.length() > 8000) {
|
||||
elements.add(new Element("<packet skipped>", "skipped"));
|
||||
}
|
||||
else {
|
||||
elements.add(new Element(packet.toString(), "incoming"));
|
||||
}
|
||||
} else {
|
||||
elements.add(new Element("Outgoing[", "outgoing"));
|
||||
elements.add(new Element(String.valueOf(packet.headerId()), ""));
|
||||
elements.add(new Element("]", "outgoing"));
|
||||
|
||||
elements.add(new Element(" -> ", ""));
|
||||
elements.add(new Element(packet.toString(), "outgoing"));
|
||||
|
||||
if (skiphugepackets && packet.length() > 8000) {
|
||||
elements.add(new Element("<packet skipped>", "skipped"));
|
||||
}
|
||||
else {
|
||||
elements.add(new Element(packet.toString(), "outgoing"));
|
||||
}
|
||||
}
|
||||
if (!expr.equals("") && displayStructure)
|
||||
if (!expr.equals("") && displayStructure && (!skiphugepackets || packet.length() <= 8000))
|
||||
elements.add(new Element("\n" + expr, "structure"));
|
||||
|
||||
elements.add(new Element("\n--------------------\n", ""));
|
||||
@ -146,6 +160,10 @@ public class UiLoggerController implements Initializable {
|
||||
autoScroll = !autoScroll;
|
||||
lblAutoScrolll.setText("Autoscroll: " + (autoScroll ? "True" : "False"));
|
||||
}
|
||||
|
||||
public void toggleSkipPackets(ActionEvent actionEvent) {
|
||||
skiphugepackets = !skiphugepackets;
|
||||
}
|
||||
}
|
||||
|
||||
class Element {
|
||||
|
@ -30,6 +30,7 @@
|
||||
<accelerator>
|
||||
<KeyCodeCombination alt="UP" code="L" control="DOWN" meta="UP" shift="UP" shortcut="UP" />
|
||||
</accelerator></CheckMenuItem>
|
||||
<CheckMenuItem fx:id="chkSkipBigPackets" mnemonicParsing="false" onAction="#toggleSkipPackets" selected="true" text="Skip big packets" />
|
||||
</Menu>
|
||||
</MenuBar>
|
||||
</top>
|
||||
|
@ -15,7 +15,7 @@
|
||||
-fx-fill: #0066cc;
|
||||
}
|
||||
|
||||
.structure {
|
||||
.structure, .skipped {
|
||||
-fx-fill: cyan;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user