diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-31 22:23:55 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-31 22:23:55 -0700 |
| commit | f13493edb2aae228ddbe70cc2f0609c541faf2d7 (patch) | |
| tree | cb1a6845ec82e2ea361ce15e88440a249992091c /node/Switch.cpp | |
| parent | 595b386afcd4e4eca0cf379cd14689c1db8ee647 (diff) | |
| download | infinitytier-f13493edb2aae228ddbe70cc2f0609c541faf2d7.tar.gz infinitytier-f13493edb2aae228ddbe70cc2f0609c541faf2d7.zip | |
Oops... turns out we need to differentiate incoming from outgoing TCP and indeed learn incoming TCP paths. Otherwise the recipient of a TCP connection does not know to reply via TCP! Heh.
Diffstat (limited to 'node/Switch.cpp')
| -rw-r--r-- | node/Switch.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp index 0e58c744..2ee3a4a0 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -214,7 +214,7 @@ void Switch::sendHELLO(const Address &dest) send(outp,false); } -bool Switch::sendHELLO(const SharedPtr<Socket> &fromSock,const SharedPtr<Peer> &dest,const InetAddress &remoteAddr) +bool Switch::sendHELLO(const SharedPtr<Peer> &dest,const Path &path) { uint64_t now = Utils::now(); Packet outp(dest->address(),_r->identity.address(),Packet::VERB_HELLO); @@ -225,10 +225,10 @@ bool Switch::sendHELLO(const SharedPtr<Socket> &fromSock,const SharedPtr<Peer> & outp.append(now); _r->identity.serialize(outp,false); outp.armor(dest->key(),false); - return fromSock->send(remoteAddr,outp.data(),outp.size()); + return _r->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 &remoteAddr,bool tcp) +bool Switch::sendHELLO(const SharedPtr<Peer> &dest,const InetAddress &destUdp) { uint64_t now = Utils::now(); Packet outp(dest->address(),_r->identity.address(),Packet::VERB_HELLO); @@ -239,7 +239,7 @@ bool Switch::sendHELLO(const SharedPtr<Peer> &dest,const InetAddress &remoteAddr outp.append(now); _r->identity.serialize(outp,false); outp.armor(dest->key(),false); - return _r->sm->send(remoteAddr,tcp,outp.data(),outp.size()); + return _r->sm->send(deskUdp,false,false,outp.data(),outp.size()); } bool Switch::unite(const Address &p1,const Address &p2,bool force) @@ -354,7 +354,7 @@ unsigned long Switch::doTimerTasks() for(std::list<ContactQueueEntry>::iterator qi(_contactQueue.begin());qi!=_contactQueue.end();) { if (now >= qi->fireAtTime) { TRACE("sending NAT-T HELLO to %s(%s)",qi->peer->address().toString().c_str(),qi->inaddr.toString().c_str()); - sendHELLO(qi->peer,qi->inaddr,false); + sendHELLO(qi->peer,qi->inaddr); _contactQueue.erase(qi++); } else { nextDelay = std::min(nextDelay,(unsigned long)(qi->fireAtTime - now)); |
