diff options
author | Tolik Zinovyev <tolik@algorand.com> | 2022-01-06 15:06:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-06 15:06:02 -0500 |
commit | 16c3053021af654ee3175e6af100d0546021e0b8 (patch) | |
tree | f2cca6c477133f3726ba04afaf981595ddd3359f | |
parent | 52a1a2cc9c20750d492f6b99dd17ae7091593ff2 (diff) |
Use rejecting limit listener in WebsocketNetwork. (#3380)
## Summary
Replace the standard limit listener with the new rejecting limit listener in `WebsocketNetwork`. This will let the dialing node know that connection is impossible faster.
## Test Plan
Probably not necessary.
-rw-r--r-- | network/wsNetwork.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/network/wsNetwork.go b/network/wsNetwork.go index 92da09f1a..525968ebf 100644 --- a/network/wsNetwork.go +++ b/network/wsNetwork.go @@ -39,12 +39,12 @@ import ( "github.com/algorand/go-deadlock" "github.com/algorand/websocket" "github.com/gorilla/mux" - "golang.org/x/net/netutil" "github.com/algorand/go-algorand/config" "github.com/algorand/go-algorand/crypto" "github.com/algorand/go-algorand/logging" "github.com/algorand/go-algorand/logging/telemetryspec" + "github.com/algorand/go-algorand/network/limitlistener" "github.com/algorand/go-algorand/protocol" tools_network "github.com/algorand/go-algorand/tools/network" "github.com/algorand/go-algorand/tools/network/dnssec" @@ -748,7 +748,8 @@ func (wn *WebsocketNetwork) Start() { return } // wrap the original listener with a limited connection listener - listener = netutil.LimitListener(listener, wn.config.IncomingConnectionsLimit) + listener = limitlistener.RejectingLimitListener( + listener, uint64(wn.config.IncomingConnectionsLimit), wn.log) // wrap the limited connection listener with a requests tracker listener wn.listener = wn.requestsTracker.Listener(listener) wn.log.Debugf("listening on %s", wn.listener.Addr().String()) |