mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +01:00
Add inbound/outbound info to peers list
This commit is contained in:
parent
43d811d9fe
commit
59e4fc6842
1 changed files with 18 additions and 9 deletions
|
@ -29,6 +29,7 @@ import io.bitsquare.p2p.NodeAddress;
|
|||
import io.bitsquare.p2p.P2PService;
|
||||
import io.bitsquare.p2p.P2PServiceListener;
|
||||
import io.bitsquare.p2p.network.LocalhostNetworkNode;
|
||||
import io.bitsquare.p2p.network.OutboundConnection;
|
||||
import io.bitsquare.p2p.seed.SeedNodesRepository;
|
||||
import io.bitsquare.user.Preferences;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
|
@ -46,6 +47,7 @@ import javax.inject.Inject;
|
|||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@FxmlView
|
||||
public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activatable> {
|
||||
|
@ -190,13 +192,20 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
|||
|
||||
private void updateP2PPeersTextArea() {
|
||||
p2PPeersTextArea.clear();
|
||||
p2PService.getNodeAddressesOfConnectedPeers().stream().forEach(e -> {
|
||||
if (p2PPeersTextArea.getText().length() > 0)
|
||||
p2PPeersTextArea.appendText("\n");
|
||||
p2PPeersTextArea.appendText(e.getFullAddress());
|
||||
if (seedNodeAddresses.contains(e))
|
||||
p2PPeersTextArea.appendText(" (Seed node)");
|
||||
});
|
||||
p2PPeersTextArea.setText(p2PService.getNetworkNode().getConfirmedConnections()
|
||||
.stream()
|
||||
.map(connection -> {
|
||||
if (connection.getPeersNodeAddressOptional().isPresent()) {
|
||||
NodeAddress nodeAddress = connection.getPeersNodeAddressOptional().get();
|
||||
return nodeAddress.getFullAddress() + " (" +
|
||||
(connection instanceof OutboundConnection ? "outbound" : "inbound") +
|
||||
(seedNodeAddresses.contains(nodeAddress) ? " / seed node)" : ")");
|
||||
} else {
|
||||
// Should never be the case
|
||||
return "";
|
||||
}
|
||||
})
|
||||
.collect(Collectors.joining("\n")));
|
||||
}
|
||||
|
||||
private void updateBitcoinPeersTextArea() {
|
||||
|
|
Loading…
Add table
Reference in a new issue