diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-01-11 17:46:52 -0800 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-01-11 17:46:52 -0800 |
commit | d7e7ad4f88ed8f5967568a9d5cec0716d1ae6265 (patch) | |
tree | d0e42a507c323bd10039d886798c122f46d59095 | |
parent | 823a1963f6c32fe124c4c8de9292c7409c7b48af (diff) | |
download | infinitytier-d7e7ad4f88ed8f5967568a9d5cec0716d1ae6265.tar.gz infinitytier-d7e7ad4f88ed8f5967568a9d5cec0716d1ae6265.zip |
Can't send a user message to self.
-rw-r--r-- | node/Node.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index 32d41305..0d0750ca 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -476,15 +476,16 @@ void Node::clearLocalInterfaceAddresses() int Node::sendUserMessage(uint64_t dest,uint64_t typeId,const void *data,unsigned int len) { try { - Packet outp(Address(dest),RR->identity.address(),Packet::VERB_USER_MESSAGE); - outp.append(typeId); - outp.append(data,len); - outp.compress(); - RR->sw->send(outp,true); - return 1; - } catch ( ... ) { - return 0; - } + if (RR->identity.address().toInt() != dest) { + Packet outp(Address(dest),RR->identity.address(),Packet::VERB_USER_MESSAGE); + outp.append(typeId); + outp.append(data,len); + outp.compress(); + RR->sw->send(outp,true); + return 1; + } + } catch ( ... ) {} + return 0; } void Node::setRole(uint64_t ztAddress,ZT_PeerRole role) |