Skip to content

Commit

Permalink
Check if err != nil returned from ConnectionManager.Ban() (#1736)
Browse files Browse the repository at this point in the history
  • Loading branch information
svarogg authored May 31, 2021
1 parent 4f4a893 commit 4f52a6d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/protocol/protocol.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package protocol

import (
"github.com/kaspanet/kaspad/app/protocol/flows/rejects"
"github.com/kaspanet/kaspad/infrastructure/network/connmanager"
"sync"
"sync/atomic"

Expand All @@ -11,10 +9,12 @@ import (
"github.com/kaspanet/kaspad/app/protocol/flows/blockrelay"
"github.com/kaspanet/kaspad/app/protocol/flows/handshake"
"github.com/kaspanet/kaspad/app/protocol/flows/ping"
"github.com/kaspanet/kaspad/app/protocol/flows/rejects"
"github.com/kaspanet/kaspad/app/protocol/flows/transactionrelay"
peerpkg "github.com/kaspanet/kaspad/app/protocol/peer"
"github.com/kaspanet/kaspad/app/protocol/protocolerrors"
"github.com/kaspanet/kaspad/infrastructure/network/addressmanager"
"github.com/kaspanet/kaspad/infrastructure/network/connmanager"
"github.com/kaspanet/kaspad/infrastructure/network/netadapter"
routerpkg "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
"github.com/pkg/errors"
Expand Down Expand Up @@ -106,7 +106,7 @@ func (m *Manager) handleError(err error, netConnection *netadapter.NetConnection
log.Warnf("Banning %s (reason: %s)", netConnection, protocolErr.Cause)

err := m.context.ConnectionManager().Ban(netConnection)
if !errors.Is(err, connmanager.ErrCannotBanPermanent) {
if err != nil && !errors.Is(err, connmanager.ErrCannotBanPermanent) {
panic(err)
}

Expand Down

0 comments on commit 4f52a6d

Please sign in to comment.