mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 13:03:45 +02:00
Get rid of onSent(), which was never used consistently anyway.
This commit is contained in:
parent
300588c5e8
commit
0133da1dcd
3 changed files with 4 additions and 39 deletions
|
@ -99,17 +99,6 @@ bool Peer::send(const RuntimeEnvironment *_r,const void *data,unsigned int len,u
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Peer::onSent(const RuntimeEnvironment *_r,bool relay,Packet::Verb verb,uint64_t now)
|
|
||||||
{
|
|
||||||
if (verb == Packet::VERB_FRAME) {
|
|
||||||
_lastUnicastFrame = now;
|
|
||||||
_dirty = true;
|
|
||||||
} else if (verb == Packet::VERB_MULTICAST_FRAME) {
|
|
||||||
_lastMulticastFrame = now;
|
|
||||||
_dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Peer::sendFirewallOpener(const RuntimeEnvironment *_r,uint64_t now)
|
bool Peer::sendFirewallOpener(const RuntimeEnvironment *_r,uint64_t now)
|
||||||
{
|
{
|
||||||
bool sent = false;
|
bool sent = false;
|
||||||
|
|
|
@ -135,20 +135,6 @@ public:
|
||||||
*/
|
*/
|
||||||
bool send(const RuntimeEnvironment *_r,const void *data,unsigned int len,uint64_t now);
|
bool send(const RuntimeEnvironment *_r,const void *data,unsigned int len,uint64_t now);
|
||||||
|
|
||||||
/**
|
|
||||||
* Must be called after a packet is successfully sent to this peer
|
|
||||||
*
|
|
||||||
* Note that 'relay' means we've sent a packet *from* this node to this
|
|
||||||
* peer by relaying it, not that we have relayed a packet from somewhere
|
|
||||||
* else to this peer. In the latter case this is not called.
|
|
||||||
*
|
|
||||||
* @param _r Runtime environment
|
|
||||||
* @param relay If true, packet was sent indirectly via a relay
|
|
||||||
* @param verb Packet verb
|
|
||||||
* @param now Current time
|
|
||||||
*/
|
|
||||||
void onSent(const RuntimeEnvironment *_r,bool relay,Packet::Verb verb,uint64_t now);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send firewall opener to active link
|
* Send firewall opener to active link
|
||||||
*
|
*
|
||||||
|
|
|
@ -216,11 +216,7 @@ bool Switch::sendHELLO(const SharedPtr<Peer> &dest,Demarc::Port localPort,const
|
||||||
_r->identity.serialize(outp,false);
|
_r->identity.serialize(outp,false);
|
||||||
outp.macSet(dest->macKey());
|
outp.macSet(dest->macKey());
|
||||||
|
|
||||||
if (_r->demarc->send(localPort,remoteAddr,outp.data(),outp.size(),-1)) {
|
return _r->demarc->send(localPort,remoteAddr,outp.data(),outp.size(),-1);
|
||||||
dest->onSent(_r,false,Packet::VERB_HELLO,now);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Switch::unite(const Address &p1,const Address &p2,bool force)
|
bool Switch::unite(const Address &p1,const Address &p2,bool force)
|
||||||
|
@ -274,8 +270,7 @@ bool Switch::unite(const Address &p1,const Address &p2,bool force)
|
||||||
}
|
}
|
||||||
outp.encrypt(p1p->cryptKey());
|
outp.encrypt(p1p->cryptKey());
|
||||||
outp.macSet(p1p->macKey());
|
outp.macSet(p1p->macKey());
|
||||||
if (p1p->send(_r,outp.data(),outp.size(),now))
|
p1p->send(_r,outp.data(),outp.size(),now);
|
||||||
p1p->onSent(_r,false,Packet::VERB_RENDEZVOUS,now);
|
|
||||||
}
|
}
|
||||||
{ // tell p2 where to find p1
|
{ // tell p2 where to find p1
|
||||||
Packet outp(p2,_r->identity.address(),Packet::VERB_RENDEZVOUS);
|
Packet outp(p2,_r->identity.address(),Packet::VERB_RENDEZVOUS);
|
||||||
|
@ -290,8 +285,7 @@ bool Switch::unite(const Address &p1,const Address &p2,bool force)
|
||||||
}
|
}
|
||||||
outp.encrypt(p2p->cryptKey());
|
outp.encrypt(p2p->cryptKey());
|
||||||
outp.macSet(p2p->macKey());
|
outp.macSet(p2p->macKey());
|
||||||
if (p2p->send(_r,outp.data(),outp.size(),now))
|
p2p->send(_r,outp.data(),outp.size(),now);
|
||||||
p2p->onSent(_r,false,Packet::VERB_RENDEZVOUS,now);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -616,10 +610,8 @@ Address Switch::_sendWhoisRequest(const Address &addr,const Address *peersAlread
|
||||||
outp.macSet(supernode->macKey());
|
outp.macSet(supernode->macKey());
|
||||||
|
|
||||||
uint64_t now = Utils::now();
|
uint64_t now = Utils::now();
|
||||||
if (supernode->send(_r,outp.data(),outp.size(),now)) {
|
if (supernode->send(_r,outp.data(),outp.size(),now))
|
||||||
supernode->onSent(_r,false,Packet::VERB_WHOIS,now);
|
|
||||||
return supernode->address();
|
return supernode->address();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Address();
|
return Address();
|
||||||
}
|
}
|
||||||
|
@ -672,8 +664,6 @@ bool Switch::_trySend(const Packet &packet,bool encrypt)
|
||||||
remaining -= chunkSize;
|
remaining -= chunkSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
via->onSent(_r,isRelay,packet.verb(),now);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue