Skip to content

Commit

Permalink
fix(sync): add IsBannedAddress check in processing connect event (#1347)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ja7ad authored Jun 18, 2024
1 parent 868a948 commit e796f2d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 9 additions & 1 deletion sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,16 @@ func (sync *synchronizer) processStreamMessage(msg *network.StreamMessage) {
func (sync *synchronizer) processConnectEvent(ce *network.ConnectEvent) {
sync.logger.Debug("processing connect event", "pid", ce.PeerID)

sync.peerSet.UpdateStatus(ce.PeerID, status.StatusConnected)
sync.peerSet.UpdateAddress(ce.PeerID, ce.RemoteAddress, ce.Direction)

if sync.firewall.IsBannedAddress(ce.RemoteAddress) {
sync.logger.Debug("Peer is blacklisted", "peer_id", ce.PeerID, "remote_address", ce.RemoteAddress)
sync.peerSet.UpdateStatus(ce.PeerID, status.StatusBanned)

return
}

sync.peerSet.UpdateStatus(ce.PeerID, status.StatusConnected)
}

func (sync *synchronizer) processProtocolsEvent(pe *network.ProtocolsEvents) {
Expand Down
6 changes: 2 additions & 4 deletions www/grpc/statik/statik.go

Large diffs are not rendered by default.

0 comments on commit e796f2d

Please sign in to comment.