Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/overlay/Peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ CapacityTrackedMessage::CapacityTrackedMessage(std::weak_ptr<Peer> peer,
{
mMaybeHash = xdrBlake2(msg);
}
if (mMsg.type() == GET_SCP_QUORUMSET || mMsg.type() == GET_TX_SET)
{
BLAKE2 blake;
blake.add(xdrBlake2(msg));
blake.add(xdrBlake2(self->getPeerID()));
mMaybeHash = blake.finish();
}

auto populateTxMap = [&](StellarMessage const& msg, Hash const& hash) {
auto transaction = TransactionFrameBase::makeTransactionFromWire(
Expand Down Expand Up @@ -829,9 +836,11 @@ void
Peer::sendMessage(std::shared_ptr<StellarMessage const> msg, bool log)
{
ZoneScoped;

CLOG_TRACE(Overlay, "send: {} to : {}", msgSummary(*msg),
mAppConnector.getConfig().toShortString(mPeerID));
{
RECURSIVE_LOCK_GUARD(mStateMutex, guard);
CLOG_TRACE(Overlay, "send: {} to : {}", msgSummary(*msg),
mAppConnector.getConfig().toShortString(mPeerID));
}

switch (msg->type())
{
Expand Down Expand Up @@ -1687,6 +1696,7 @@ Peer::recvGetSCPState(StellarMessage const& msg)
releaseAssert(threadIsMain());
if (!process(mSCPStateQueryInfo, GET_SCP_STATE_MAX_RATE))
{
RECURSIVE_LOCK_GUARD(mStateMutex, guard);
CLOG_DEBUG(Overlay, "Dropping GET_SCP_STATE request from {}",
KeyUtils::toShortString(mPeerID));
return;
Expand Down Expand Up @@ -1771,7 +1781,7 @@ Peer::updatePeerRecordAfterAuthentication()
mAppConnector.getOverlayManager().getPeerManager().update(
getAddress(), PeerManager::BackOffUpdate::RESET);
}

RECURSIVE_LOCK_GUARD(mStateMutex, guard);
CLOG_DEBUG(Overlay, "successful handshake with {}@{}",
mAppConnector.getConfig().toShortString(mPeerID), toString());
}
Expand Down
5 changes: 3 additions & 2 deletions src/overlay/Peer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "overlay/Hmac.h"
#include "overlay/PeerBareAddress.h"
#include "transactions/TransactionFrameBase.h"
#include "util/GlobalChecks.h"
#include "util/NonCopyable.h"
#include "util/ThreadAnnotations.h"
#include "util/Timer.h"
Expand Down Expand Up @@ -258,7 +259,7 @@ class Peer : public std::enable_shared_from_this<Peer>,
// synchronize access manually
private:
PeerState mState GUARDED_BY(mStateMutex);
NodeID mPeerID;
NodeID mPeerID GUARDED_BY(mStateMutex);
uint256 mSendNonce;
uint256 mRecvNonce;

Expand Down Expand Up @@ -415,7 +416,7 @@ class Peer : public std::enable_shared_from_this<Peer>,
NodeID
getPeerID() const
{
releaseAssert(threadIsMain());
RECURSIVE_LOCK_GUARD(mStateMutex, guard);
return mPeerID;
}

Expand Down
Loading