Plumbing through of remote trace into controller code.
This commit is contained in:
parent
0655a1fcbe
commit
4ecc0c59ca
7 changed files with 148 additions and 5 deletions
|
@ -1192,7 +1192,7 @@ bool IncomingPacket::_doPUSH_DIRECT_PATHS(const RuntimeEnvironment *RR,void *tPt
|
|||
bool IncomingPacket::_doUSER_MESSAGE(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr<Peer> &peer)
|
||||
{
|
||||
try {
|
||||
if (size() >= (ZT_PACKET_IDX_PAYLOAD + 8)) {
|
||||
if (likely(size() >= (ZT_PACKET_IDX_PAYLOAD + 8))) {
|
||||
ZT_UserMessage um;
|
||||
um.origin = peer->address().toInt();
|
||||
um.typeId = at<uint64_t>(ZT_PACKET_IDX_PAYLOAD);
|
||||
|
@ -1207,6 +1207,31 @@ bool IncomingPacket::_doUSER_MESSAGE(const RuntimeEnvironment *RR,void *tPtr,con
|
|||
return true;
|
||||
}
|
||||
|
||||
bool IncomingPacket::_doREMOTE_TRACE(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr<Peer> &peer)
|
||||
{
|
||||
ZT_RemoteTrace rt;
|
||||
try {
|
||||
const char *ptr = reinterpret_cast<const char *>(data()) + ZT_PACKET_IDX_PAYLOAD;
|
||||
const char *const eof = reinterpret_cast<const char *>(data()) + size();
|
||||
rt.origin = peer->address().toInt();
|
||||
rt.data = const_cast<char *>(ptr); // start of first string
|
||||
while (ptr < eof) {
|
||||
if (!*ptr) { // end of string
|
||||
rt.len = (unsigned int)(ptr - rt.data);
|
||||
if ((rt.len > 0)&&(rt.len <= ZT_MAX_REMOTE_TRACE_SIZE))
|
||||
RR->node->postEvent(tPtr,ZT_EVENT_REMOTE_TRACE,&rt);
|
||||
rt.data = const_cast<char *>(++ptr); // start of next string, if any
|
||||
} else {
|
||||
++ptr;
|
||||
}
|
||||
}
|
||||
peer->received(tPtr,_path,hops(),packetId(),Packet::VERB_REMOTE_TRACE,0,Packet::VERB_NOP,false,0);
|
||||
} catch ( ... ) {
|
||||
RR->t->incomingPacketInvalid(tPtr,_path,packetId(),source(),hops(),Packet::VERB_REMOTE_TRACE,"unexpected exception");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void IncomingPacket::_sendErrorNeedCredentials(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr<Peer> &peer,const uint64_t nwid)
|
||||
{
|
||||
const uint64_t now = RR->node->now();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue