Get rid of onSent(), which was never used consistently anyway.

This commit is contained in:
Adam Ierymenko 2013-09-17 15:33:34 -04:00
parent 300588c5e8
commit 0133da1dcd
3 changed files with 4 additions and 39 deletions

View File

@ -99,17 +99,6 @@ bool Peer::send(const RuntimeEnvironment *_r,const void *data,unsigned int len,u
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 sent = false;

View File

@ -135,20 +135,6 @@ public:
*/
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
*

View File

@ -216,11 +216,7 @@ bool Switch::sendHELLO(const SharedPtr<Peer> &dest,Demarc::Port localPort,const
_r->identity.serialize(outp,false);
outp.macSet(dest->macKey());
if (_r->demarc->send(localPort,remoteAddr,outp.data(),outp.size(),-1)) {
dest->onSent(_r,false,Packet::VERB_HELLO,now);
return true;
}
return false;
return _r->demarc->send(localPort,remoteAddr,outp.data(),outp.size(),-1);
}
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.macSet(p1p->macKey());
if (p1p->send(_r,outp.data(),outp.size(),now))
p1p->onSent(_r,false,Packet::VERB_RENDEZVOUS,now);
p1p->send(_r,outp.data(),outp.size(),now);
}
{ // tell p2 where to find p1
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.macSet(p2p->macKey());
if (p2p->send(_r,outp.data(),outp.size(),now))
p2p->onSent(_r,false,Packet::VERB_RENDEZVOUS,now);
p2p->send(_r,outp.data(),outp.size(),now);
}
return true;
@ -616,10 +610,8 @@ Address Switch::_sendWhoisRequest(const Address &addr,const Address *peersAlread
outp.macSet(supernode->macKey());
uint64_t now = Utils::now();
if (supernode->send(_r,outp.data(),outp.size(),now)) {
supernode->onSent(_r,false,Packet::VERB_WHOIS,now);
if (supernode->send(_r,outp.data(),outp.size(),now))
return supernode->address();
}
}
return Address();
}
@ -672,8 +664,6 @@ bool Switch::_trySend(const Packet &packet,bool encrypt)
remaining -= chunkSize;
}
}
via->onSent(_r,isRelay,packet.verb(),now);
return true;
}
return false;