Skip to content

Commit

Permalink
Count invalid echos received per peer
Browse files Browse the repository at this point in the history
  • Loading branch information
Brutus5000 committed Jun 13, 2024
1 parent 81cbd98 commit 0173f58
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public void peerConnectivityUpdate(Peer peer) {
p.averageRtt.set(connectivityChecker.map(PeerConnectivityCheckerModule::getAverageRTT).orElse(-1.0f).intValue());
p.lastReceived.set(connectivityChecker.map(PeerConnectivityCheckerModule::getLastPacketReceived).map(last -> System.currentTimeMillis() - last).orElse(-1L).intValue());
p.echosReceived.set(connectivityChecker.map(PeerConnectivityCheckerModule::getEchosReceived).orElse(-1L).intValue());
p.echosReceived.set(connectivityChecker.map(PeerConnectivityCheckerModule::getEchosReceived).orElse(-1L).intValue());
});
}
});
Expand Down Expand Up @@ -213,6 +214,7 @@ public static class DebugPeer {
public SimpleIntegerProperty averageRtt = new SimpleIntegerProperty(-1);
public SimpleIntegerProperty lastReceived = new SimpleIntegerProperty(-1);
public SimpleIntegerProperty echosReceived = new SimpleIntegerProperty(-1);
public SimpleIntegerProperty invalidEchosReceived = new SimpleIntegerProperty(-1);
public SimpleStringProperty localCandidate = new SimpleStringProperty("");
public SimpleStringProperty remoteCandidate = new SimpleStringProperty("");

Expand Down Expand Up @@ -276,8 +278,14 @@ public int getEchosReceived() {
return echosReceived.get();
}

public int getInvalidEchosReceived() {
return invalidEchosReceived.get();
}

public SimpleIntegerProperty echosReceivedProperty() { return echosReceived; }

public SimpleIntegerProperty invalidEchosReceivedProperty() { return invalidEchosReceived; }

public String getLocalCandidate() {
return localCandidate.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class DebugWindowController {
public TableColumn rttColumn;
public TableColumn lastColumn;
public TableColumn echosRcvColumn;
public TableColumn invalidEchosRcvColumn;
public TableColumn localCandColumn;
public TableColumn remoteCandColumn;

Expand Down Expand Up @@ -66,6 +67,7 @@ private void initialize() {
rttColumn.setCellValueFactory(new PropertyValueFactory<>("averageRtt"));
lastColumn.setCellValueFactory(new PropertyValueFactory<>("lastReceived"));
echosRcvColumn.setCellValueFactory(new PropertyValueFactory<>("echosReceived"));
invalidEchosRcvColumn.setCellValueFactory(new PropertyValueFactory<>("invalidEchosReceived"));
localCandColumn.setCellValueFactory(new PropertyValueFactory<>("localCandidate"));
remoteCandColumn.setCellValueFactory(new PropertyValueFactory<>("remoteCandidate"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class PeerConnectivityCheckerModule {
@Getter private float averageRTT = 0.0f;
@Getter private long lastPacketReceived;
@Getter private long echosReceived = 0;
@Getter private long invalidEchosReceived = 0;

public PeerConnectivityCheckerModule(PeerIceModule ice) {
this.ice = ice;
Expand Down Expand Up @@ -73,6 +74,7 @@ void echoReceived(byte[] data, int offset, int length) {

if (length != 9) {
log.trace("Received echo of wrong length, length: {}", length);
invalidEchosReceived++;
}

int rtt = (int) (System.currentTimeMillis() - Longs.fromByteArray(Arrays.copyOfRange(data, offset + 1, length)));
Expand Down
1 change: 1 addition & 0 deletions ice-adapter/src/main/resources/debugWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<TableColumn fx:id="rttColumn" prefWidth="100.0" text="average rtt" />
<TableColumn fx:id="lastColumn" prefWidth="100.0" text="last recv" />
<TableColumn fx:id="echosRcvColumn" prefWidth="100.0" text="echos recv" />
<TableColumn fx:id="invalidEchosRcvColumn" prefWidth="100.0" text="invalid echos recv" />
</columns>
</TableView>

Expand Down

0 comments on commit 0173f58

Please sign in to comment.