diff options
Diffstat (limited to 'node/Network.cpp')
| -rw-r--r-- | node/Network.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/node/Network.cpp b/node/Network.cpp index e11d7d1a..2b9d59e1 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -535,15 +535,11 @@ void Network::threadMain() void Network::_CBhandleTapData(void *arg,const MAC &from,const MAC &to,unsigned int etherType,const Buffer<4096> &data) { - if ((!((Network *)arg)->_enabled)||(((Network *)arg)->status() != NETWORK_OK)) + SharedPtr<Network> network((Network *)arg,true); + if ((!network)||(!network->_enabled)||(network->status() != NETWORK_OK)) return; - - const RuntimeEnvironment *RR = ((Network *)arg)->RR; - if (RR->shutdownInProgress) - return; - try { - RR->sw->onLocalEthernet(SharedPtr<Network>((Network *)arg),from,to,etherType,data); + network->RR->sw->onLocalEthernet(network,from,to,etherType,data); } catch (std::exception &exc) { TRACE("unexpected exception handling local packet: %s",exc.what()); } catch ( ... ) { |
