mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-18 17:00:17 +00:00
More work on connection reset stuff...
This commit is contained in:
parent
d75f2f7051
commit
6e076e77d8
@ -641,6 +641,7 @@ Node::ReasonForTermination Node::run()
|
||||
}
|
||||
}
|
||||
} catch ( ... ) {
|
||||
LOG("FATAL: unexpected exception in core loop: unknown exception");
|
||||
return impl->terminateBecause(Node::NODE_UNRECOVERABLE_ERROR,"unexpected exception during outer main I/O loop");
|
||||
}
|
||||
|
||||
|
@ -67,10 +67,10 @@ Switch::~Switch()
|
||||
void Switch::onRemotePacket(Demarc::Port localPort,const InetAddress &fromAddr,const Buffer<4096> &data)
|
||||
{
|
||||
try {
|
||||
if (data.size() > ZT_PROTO_MIN_FRAGMENT_LENGTH) {
|
||||
if (data.size() >= ZT_PROTO_MIN_FRAGMENT_LENGTH) {
|
||||
if (data[ZT_PACKET_FRAGMENT_IDX_FRAGMENT_INDICATOR] == ZT_PACKET_FRAGMENT_INDICATOR)
|
||||
_handleRemotePacketFragment(localPort,fromAddr,data);
|
||||
else if (data.size() > ZT_PROTO_MIN_PACKET_LENGTH)
|
||||
else if (data.size() >= ZT_PROTO_MIN_PACKET_LENGTH)
|
||||
_handleRemotePacketHead(localPort,fromAddr,data);
|
||||
}
|
||||
} catch (std::exception &ex) {
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "InetAddress.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "Packet.hpp"
|
||||
#include "Logger.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
@ -250,16 +251,18 @@ public:
|
||||
public:
|
||||
ResetActivePeers(const RuntimeEnvironment *renv,uint64_t now) throw() :
|
||||
_now(now),
|
||||
_supernode(_r->topology->getBestSupernode()),
|
||||
_supernodeAddresses(_r->topology->supernodeAddresses()),
|
||||
_supernode(renv->topology->getBestSupernode()),
|
||||
_supernodeAddresses(renv->topology->supernodeAddresses()),
|
||||
_r(renv) {}
|
||||
|
||||
inline void operator()(Topology &t,const SharedPtr<Peer> &p)
|
||||
{
|
||||
if (_supernodeAddresses.count(p->address()))
|
||||
return; // skip supernodes
|
||||
TRACE(">> %s",p->address().toString().c_str());
|
||||
p->forgetDirectPaths(false); // false means don't forget 'fixed' paths e.g. supernodes
|
||||
if (((_now - p->lastFrame()) < ZT_PEER_LINK_ACTIVITY_TIMEOUT)&&(_supernode)) {
|
||||
TRACE("sending NOP to %s",p->address().toString().c_str());
|
||||
Packet outp(p->address(),_r->identity.address(),Packet::VERB_NOP);
|
||||
outp.armor(p->key(),false); // no need to encrypt a NOP
|
||||
_supernode->send(_r,outp.data(),outp.size(),_now);
|
||||
|
Loading…
x
Reference in New Issue
Block a user