From a95f1e1418b0a14f29365202d0df11b76c2578bb Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 3 Apr 2015 17:01:07 -0700 Subject: Eliminate redundant SharedPtr assignment. --- node/Switch.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'node') diff --git a/node/Switch.cpp b/node/Switch.cpp index 8f1fed66..5e120341 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -771,13 +771,10 @@ bool Switch::_trySend(const Packet &packet,bool encrypt) if (peer) { const uint64_t now = RR->node->now(); - SharedPtr via; - Path *viaPath; - if ((viaPath = peer->getBestPath(now))) { - via = peer; - } else { - via = RR->topology->getBestSupernode(); - if (!(via)||(!(viaPath = via->getBestPath(now)))) + Path *viaPath = peer->getBestPath(now); + if (!viaPath) { + SharedPtr sn(RR->topology->getBestSupernode()); + if (!(sn)||(!(viaPath = sn->getBestPath(now)))) return false; } -- cgit v1.2.3