Skip to content

Commit

Permalink
Enforce no duplicate slots from incoming connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek committed Mar 8, 2024
1 parent e74cb35 commit b33fbb3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ripple/peerfinder/impl/Logic.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class Logic

std::lock_guard _(lock_);

// Check for duplicate connection
// Check for connection limit per address
if (is_public(remote_endpoint))
{
auto const count =
Expand All @@ -287,6 +287,15 @@ class Logic
}
}

// Check for duplicate connection
if (slots_.find(remote_endpoint) != slots_.end())
{
JLOG(m_journal.debug())
<< beast::leftw(18) << "Logic dropping " << remote_endpoint
<< " as duplicate incoming";
return SlotImp::ptr();
}

// Create the slot
SlotImp::ptr const slot(std::make_shared<SlotImp>(
local_endpoint,
Expand Down

0 comments on commit b33fbb3

Please sign in to comment.