The concept of link desperation (escalating to less desirable transports) simplifies a ton of stuff. Loads of spaghetti logic can die since we no longer have to make these decisions down in the core.

This commit is contained in:
Adam Ierymenko 2015-04-02 17:54:56 -07:00
parent 5f51653f9c
commit a69e1876f1
11 changed files with 180 additions and 428 deletions

View file

@ -270,6 +270,7 @@ void Switch::send(const Packet &packet,bool encrypt)
}
}
#if 0
void Switch::sendHELLO(const Address &dest)
{
Packet outp(dest,RR->identity.address(),Packet::VERB_HELLO);
@ -281,36 +282,7 @@ void Switch::sendHELLO(const Address &dest)
RR->identity.serialize(outp,false);
send(outp,false);
}
bool Switch::sendHELLO(const SharedPtr<Peer> &dest,const Path &path)
{
uint64_t now = Utils::now();
Packet outp(dest->address(),RR->identity.address(),Packet::VERB_HELLO);
outp.append((unsigned char)ZT_PROTO_VERSION);
outp.append((unsigned char)ZEROTIER_ONE_VERSION_MAJOR);
outp.append((unsigned char)ZEROTIER_ONE_VERSION_MINOR);
outp.append((uint16_t)ZEROTIER_ONE_VERSION_REVISION);
outp.append(now);
RR->identity.serialize(outp,false);
outp.armor(dest->key(),false);
RR->antiRec->logOutgoingZT(outp.data(),outp.size());
return RR->sm->send(path.address(),path.tcp(),path.type() == Path::PATH_TYPE_TCP_OUT,outp.data(),outp.size());
}
bool Switch::sendHELLO(const SharedPtr<Peer> &dest,const InetAddress &destUdp)
{
uint64_t now = Utils::now();
Packet outp(dest->address(),RR->identity.address(),Packet::VERB_HELLO);
outp.append((unsigned char)ZT_PROTO_VERSION);
outp.append((unsigned char)ZEROTIER_ONE_VERSION_MAJOR);
outp.append((unsigned char)ZEROTIER_ONE_VERSION_MINOR);
outp.append((uint16_t)ZEROTIER_ONE_VERSION_REVISION);
outp.append(now);
RR->identity.serialize(outp,false);
outp.armor(dest->key(),false);
RR->antiRec->logOutgoingZT(outp.data(),outp.size());
return RR->sm->send(destUdp,false,false,outp.data(),outp.size());
}
#endif
bool Switch::unite(const Address &p1,const Address &p2,bool force)
{