Skip to content

Commit

Permalink
Merge pull request #33 from renproject/release/0.3.10
Browse files Browse the repository at this point in the history
Release v0.3.10
  • Loading branch information
loongy authored Jun 30, 2020
2 parents d739b09 + 6b30145 commit 57689fe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
12 changes: 12 additions & 0 deletions peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package peer
import (
"context"
"fmt"
"math/rand"
"time"

"github.com/renproject/aw/broadcast"
Expand Down Expand Up @@ -194,6 +195,17 @@ func (peer *peer) bootstrap(ctx context.Context) {
return
}

rand.Shuffle(len(peerAddrs), func(i, j int) {
tmp := peerAddrs[i]
peerAddrs[i] = peerAddrs[j]
peerAddrs[j] = tmp
})
maxPeerAddrs := 10
if len(peerAddrs) < maxPeerAddrs {
maxPeerAddrs = len(peerAddrs)
}
peerAddrs = peerAddrs[:maxPeerAddrs]

protocol.ParForAllAddresses(peerAddrs, peer.options.NumWorkers, func(peerAddr protocol.PeerAddress) {
// Timeout is computed to ensure that we are ready for the next
// bootstrap tick even if every single ping takes the maximum amount of
Expand Down
2 changes: 1 addition & 1 deletion tcp/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var _ = Describe("Connection pool", func() {
_ = NewTCPServer(ctx, ServerOptions{Host: serverAddr2.String()}, clientSignVerifier)

// Wait for servers to start
time.Sleep(100 * time.Millisecond)
time.Sleep(1000 * time.Millisecond)

// Expect the second send operation failing due to reaching max number of connections
message := RandomMessage(protocol.V1, RandomMessageVariant())
Expand Down
1 change: 0 additions & 1 deletion tcp/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ func (server *Server) handle(ctx context.Context, conn net.Conn, messages protoc
now := time.Now()
session, err := server.establishSession(ctx, conn)
if err != nil {
server.logger.Errorf("closing connection: error establishing session: %v", err)
return
}
if session == nil {
Expand Down

0 comments on commit 57689fe

Please sign in to comment.