Skip to content

Commit c4d6980

Browse files
core: emit warning when connected via registry-proxy (#230)
1 parent c7307c8 commit c4d6980

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

SilKit/source/core/vasio/VAsioConnection.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,12 @@ void VAsioConnection::SendParticipantAnnouncementReply(IVAsioPeer* peer)
745745
ExtractProtocolVersion(reply.remoteHeader));
746746

747747
peer->SendSilKitMsg(SerializedMessage{peer->GetProtocolVersion(), reply});
748+
749+
if (const auto proxyPeer = dynamic_cast<VAsioProxyPeer*>(peer); proxyPeer != nullptr)
750+
{
751+
Log::Warn(_logger, "Connected to {:?} ({:?}) using {:?} as a proxy", proxyPeer->GetInfo().participantName,
752+
proxyPeer->GetSimulationName(), proxyPeer->GetPeer()->GetInfo().participantName);
753+
}
748754
}
749755

750756
void VAsioConnection::SendFailedParticipantAnnouncementReply(IVAsioPeer* peer, ProtocolVersion version,
@@ -818,6 +824,12 @@ void VAsioConnection::ReceiveParticipantAnnouncementReply(IVAsioPeer* from, Seri
818824
_connectKnownParticipants.HandlePeerEvent(from->GetInfo().participantName,
819825
ConnectKnownParticipants::PeerEvent::PARTICIPANT_ANNOUNCEMENT_REPLY);
820826
}
827+
828+
if (const auto proxyPeer = dynamic_cast<VAsioProxyPeer*>(from); proxyPeer != nullptr)
829+
{
830+
Log::Warn(_logger, "Connected to {:?} ({:?}) using {:?} as a proxy", proxyPeer->GetInfo().participantName,
831+
proxyPeer->GetSimulationName(), proxyPeer->GetPeer()->GetInfo().participantName);
832+
}
821833
}
822834

823835
void VAsioConnection::ReceiveKnownParticpants(IVAsioPeer* peer, SerializedMessage&& buffer)
@@ -1440,7 +1452,15 @@ void VAsioConnection::ReceiveProxyMessage(IVAsioPeer* from, SerializedMessage&&
14401452
// We are relaying a message from source to destination and acting as a proxy. Record the association between
14411453
// source and destination. This is used during disconnects, where we create empty ProxyMessages on behalf of
14421454
// the disconnected peer, to inform the destination that the source peer has disconnected.
1443-
_proxySourceToDestinations[fromSimulationName][proxyMessage.source].insert(proxyMessage.destination);
1455+
auto [it, inserted] =
1456+
_proxySourceToDestinations[fromSimulationName][proxyMessage.source].insert(proxyMessage.destination);
1457+
SILKIT_UNUSED_ARG(it);
1458+
1459+
if (inserted)
1460+
{
1461+
Log::Warn(_logger, "Acting as proxy between {:?} ({:?}) and {:?} ({:?})", proxyMessage.source,
1462+
fromSimulationName, proxyMessage.destination, fromSimulationName);
1463+
}
14441464

14451465
return;
14461466
}

0 commit comments

Comments
 (0)