Improve broadcast listener handling, add randomized delay for messages to all connected peers

This commit is contained in:
Manfred Karrer 2016-02-23 13:04:49 +01:00
parent 2de98b6af4
commit 0908c6d61f
13 changed files with 405 additions and 249 deletions

View file

@ -204,8 +204,8 @@ public class MainViewModel implements ViewModel {
new Popup().warning("The application could not startup after 3 minutes.\n" +
"There might be some network connection problems or a unstable Tor path.\n\n" +
"Please restart and try again.")
.closeButtonText("Shut down")
.onClose(BitsquareApp.shutDownHandler::run)
.actionButtonText("Shut down and start again")
.onAction(BitsquareApp.shutDownHandler::run)
.show();
}, 3, TimeUnit.MINUTES);

View file

@ -42,7 +42,7 @@
<Label fx:id="bitcoinPeersLabel" text="Connected peers:" GridPane.rowIndex="2"/>
<TextArea fx:id="bitcoinPeersTextArea" GridPane.rowIndex="2" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS"
GridPane.vgrow="ALWAYS" editable="false" focusTraversable="false"/>
GridPane.vgrow="SOMETIMES" editable="false" focusTraversable="false"/>
<TitledGroupBg text="P2P network" GridPane.rowIndex="3" GridPane.rowSpan="5">
<padding>
@ -66,7 +66,8 @@
</TextField>
<Label fx:id="p2PPeersLabel" text="Connected peers:" GridPane.rowIndex="4"/>
<TableView fx:id="p2PPeerTable" GridPane.rowIndex="4" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS">
<TableView fx:id="p2PPeerTable" GridPane.rowIndex="4" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS"
GridPane.vgrow="ALWAYS">
<columns>
<TableColumn text="Onion address" fx:id="onionAddressColumn" minWidth="220">
<cellValueFactory>

View file

@ -96,7 +96,7 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
GridPane.setMargin(p2PPeersLabel, new Insets(4, 0, 0, 0));
GridPane.setValignment(p2PPeersLabel, VPos.TOP);
bitcoinPeersTextArea.setPrefRowCount(12);
bitcoinPeersTextArea.setPrefRowCount(10);
netWorkComboBox.setItems(FXCollections.observableArrayList(BitcoinNetwork.values()));
netWorkComboBox.getSelectionModel().select(preferences.getBitcoinNetwork());
netWorkComboBox.setOnAction(e -> onSelectNetwork());
@ -142,11 +142,13 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
}
};
p2PPeerTable.setMinHeight(300);
p2PPeerTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
p2PPeerTable.setPlaceholder(new Label("No connections are available"));
p2PPeerTable.getSortOrder().add(creationDateColumn);
creationDateColumn.setSortType(TableColumn.SortType.ASCENDING);
//TODO sorting needs other NetworkStatisticListItem as columns type
/* creationDateColumn.setComparator((o1, o2) ->
o1.statistic.getCreationDate().compareTo(o2.statistic.getCreationDate()));