mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-20 21:43:08 +00:00
Clusters can send multiple OKs so we must allow this.
This commit is contained in:
parent
9f550292fe
commit
0b44919ba2
@ -1481,14 +1481,15 @@ bool IncomingPacket::_doREQUEST_PROOF_OF_WORK(const RuntimeEnvironment *RR,const
|
|||||||
|
|
||||||
void IncomingPacket::_sendErrorNeedCredentials(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer,const uint64_t nwid)
|
void IncomingPacket::_sendErrorNeedCredentials(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer,const uint64_t nwid)
|
||||||
{
|
{
|
||||||
if (peer->rateGateOutgoingComRequest(RR->node->now())) {
|
const uint64_t now = RR->node->now();
|
||||||
|
if (peer->rateGateOutgoingComRequest(now)) {
|
||||||
Packet outp(source(),RR->identity.address(),Packet::VERB_ERROR);
|
Packet outp(source(),RR->identity.address(),Packet::VERB_ERROR);
|
||||||
outp.append((uint8_t)verb());
|
outp.append((uint8_t)verb());
|
||||||
outp.append(packetId());
|
outp.append(packetId());
|
||||||
outp.append((uint8_t)Packet::ERROR_NEED_MEMBERSHIP_CERTIFICATE);
|
outp.append((uint8_t)Packet::ERROR_NEED_MEMBERSHIP_CERTIFICATE);
|
||||||
outp.append(nwid);
|
outp.append(nwid);
|
||||||
outp.armor(peer->key(),true);
|
outp.armor(peer->key(),true);
|
||||||
_path->send(RR,outp.data(),outp.size(),RR->node->now());
|
_path->send(RR,outp.data(),outp.size(),now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,19 +267,17 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether a given packet ID is something we are expecting a reply to (and erase from list)
|
* Check whether a given packet ID is something we are expecting a reply to
|
||||||
*
|
*
|
||||||
* @param packetId Packet ID to check
|
* @param packetId Packet ID to check
|
||||||
* @return True if we're expecting a reply
|
* @return True if we're expecting a reply
|
||||||
*/
|
*/
|
||||||
inline bool expectingReplyTo(const uint64_t packetId)
|
inline bool expectingReplyTo(const uint64_t packetId) const
|
||||||
{
|
{
|
||||||
const unsigned long bucket = (unsigned long)(packetId & ZT_EXPECTING_REPLIES_BUCKET_MASK1);
|
const unsigned long bucket = (unsigned long)(packetId & ZT_EXPECTING_REPLIES_BUCKET_MASK1);
|
||||||
for(unsigned long i=0;i<=ZT_EXPECTING_REPLIES_BUCKET_MASK2;++i) {
|
for(unsigned long i=0;i<=ZT_EXPECTING_REPLIES_BUCKET_MASK2;++i) {
|
||||||
if (_expectingRepliesTo[bucket][i] == packetId) {
|
if (_expectingRepliesTo[bucket][i] == packetId)
|
||||||
_expectingRepliesTo[bucket][i] = 0;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user