mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-20 04:08:09 -04:00
Use long instead of int for bytes in statistics
This commit is contained in:
parent
1335238591
commit
1dae1dd096
4 changed files with 18 additions and 16 deletions
|
@ -152,7 +152,7 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
|||
nodeAddress -> onionAddress.setText(nodeAddress == null ? "Not known yet..." : p2PService.getAddress().getFullAddress()));
|
||||
numP2PPeersSubscription = EasyBind.subscribe(p2PService.getNumConnectedPeers(), numPeers -> updateP2PTable());
|
||||
totalTraffic.textProperty().bind(EasyBind.combine(Statistic.totalSentBytesProperty(), Statistic.totalReceivedBytesProperty(),
|
||||
(sent, received) -> "Sent: " + formatter.formatBytes((int) sent) + ", received: " + formatter.formatBytes((int) received)));
|
||||
(sent, received) -> "Sent: " + formatter.formatBytes((long) sent) + ", received: " + formatter.formatBytes((long) received)));
|
||||
|
||||
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
|
||||
tableView.setItems(sortedList);
|
||||
|
|
|
@ -55,9 +55,9 @@ public class P2pNetworkListItem {
|
|||
this.statistic = connection.getStatistic();
|
||||
|
||||
sentBytesSubscription = EasyBind.subscribe(statistic.sentBytesProperty(),
|
||||
e -> sentBytes.set(formatter.formatBytes((int) e)));
|
||||
e -> sentBytes.set(formatter.formatBytes((long) e)));
|
||||
receivedBytesSubscription = EasyBind.subscribe(statistic.receivedBytesProperty(),
|
||||
e -> receivedBytes.set(formatter.formatBytes((int) e)));
|
||||
e -> receivedBytes.set(formatter.formatBytes((long) e)));
|
||||
onionAddressSubscription = EasyBind.subscribe(connection.peersNodeAddressProperty(),
|
||||
nodeAddress -> onionAddress.set(nodeAddress != null ? nodeAddress.getFullAddress() : "Not known yet"));
|
||||
roundTripTimeSubscription = EasyBind.subscribe(statistic.roundTripTimeProperty(),
|
||||
|
|
|
@ -489,7 +489,7 @@ public class BSFormatter {
|
|||
return isOfferer ? "Seller (offerer)" : "Buyer (taker)";
|
||||
}
|
||||
|
||||
public String formatBytes(int bytes) {
|
||||
public String formatBytes(long bytes) {
|
||||
double kb = 1024;
|
||||
double mb = kb * kb;
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue