Skip to content

Commit

Permalink
Remove unused timeout parameter for GetConnectedPeers()
Browse files Browse the repository at this point in the history
  • Loading branch information
bahner committed Nov 26, 2023
1 parent 4d60f5f commit 442ec8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions p2p/peers.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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() {

Expand Down
4 changes: 1 addition & 3 deletions ui/peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ui
import (
"fmt"
"sort"
"time"

"github.com/bahner/go-ma-actor/p2p"
"github.com/bahner/go-ma-actor/peer"
Expand All @@ -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()
Expand Down

0 comments on commit 442ec8a

Please sign in to comment.