From 442ec8a19da5248f10903949594c5c628c152388 Mon Sep 17 00:00:00 2001 From: Lars Bahner Date: Sun, 26 Nov 2023 20:45:33 +0100 Subject: [PATCH] Remove unused timeout parameter for GetConnectedPeers() --- README.md | 6 +++--- p2p/peers.go | 4 +--- ui/peers.go | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 532ec85..4fb5e58 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ eval $(go run . -genenv -forcePublish | tee .env) type `./go-ma-actor -help`. Most config settings can be set with environment variables, as follows: ```bash -export GO_MA_ACTOR_LOG_LEVEL="error" -export GO_MA_ACTOR_DISCOVERY_TIMEOUT="300" -export GO_MA_ACTOR_KEYSET="myBase58EncodedPrivkeyGeneratedByGenerate" +export GO_MA_LOG_LEVEL="error" +export GO_MA_DISCOVERY_TIMEOUT="300" +export GO_MA_KEYSET="myBase58EncodedPrivkeyGeneratedByGenerate" ``` ## Identity diff --git a/p2p/peers.go b/p2p/peers.go index 5f47641..3a383c2 100644 --- a/p2p/peers.go +++ b/p2p/peers.go @@ -1,8 +1,6 @@ package p2p import ( - "time" - "github.com/bahner/go-ma" "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" @@ -13,7 +11,7 @@ var ( ) // Get list of connected peers. -func GetConnectedPeers(connectTimeout time.Duration) map[string]*peer.AddrInfo { +func GetConnectedPeers() map[string]*peer.AddrInfo { for _, p := range n.Network().Peers() { diff --git a/ui/peers.go b/ui/peers.go index c890525..a36996e 100644 --- a/ui/peers.go +++ b/ui/peers.go @@ -3,7 +3,6 @@ package ui import ( "fmt" "sort" - "time" "github.com/bahner/go-ma-actor/p2p" "github.com/bahner/go-ma-actor/peer" @@ -27,8 +26,7 @@ func (ui *ChatUI) handleAliasCommand(args []string) { func (ui *ChatUI) refreshPeers() { // Tweak this to change the timeout for peer discovery - peerConnectTimeout := 2 - peers := p2p.GetConnectedPeers(time.Duration(peerConnectTimeout) * time.Second) + peers := p2p.GetConnectedPeers() // clear is thread-safe ui.peersList.Clear()