summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-29 22:04:23 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-29 22:04:23 -0800
commit6e076e77d82ef78d407fab66b235fe936c02d13a (patch)
tree8dc64251edbc424ab8e049254e25181a24006e6e
parentd75f2f7051c3d0b92cc801e32565b643a0bac4c0 (diff)
downloadinfinitytier-6e076e77d82ef78d407fab66b235fe936c02d13a.tar.gz
infinitytier-6e076e77d82ef78d407fab66b235fe936c02d13a.zip
More work on connection reset stuff...
-rw-r--r--node/Node.cpp1
-rw-r--r--node/Switch.cpp4
-rw-r--r--node/Topology.hpp7
3 files changed, 8 insertions, 4 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index 106c508d..323e8b21 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -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");
}
diff --git a/node/Switch.cpp b/node/Switch.cpp
index 77a056c2..9ec15411 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -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) {
diff --git a/node/Topology.hpp b/node/Topology.hpp
index 4ebc7293..505cf10e 100644
--- a/node/Topology.hpp
+++ b/node/Topology.hpp
@@ -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);