X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FPPI%2FConnectors.cc;h=04ce2bd056b856023ca88a9b3afa80dbf3676db1;hb=8ee8742d5bcf846e0ebeb2abf994e371142b7707;hp=156a717af5c03b3fe1669013f5b663192da84b8a;hpb=26610f603ebdd465307b9621f532c1fe19fd5571;p=senf.git diff --git a/senf/PPI/Connectors.cc b/senf/PPI/Connectors.cc index 156a717..04ce2bd 100644 --- a/senf/PPI/Connectors.cc +++ b/senf/PPI/Connectors.cc @@ -120,40 +120,44 @@ namespace { ConsoleRegister::ConsoleRegister() { senf::ppi::ModuleManager::instance().consoleDir() - .add("tracing", SENF_FNP(senf::ppi::connector::Connector::TraceState, - senf::ppi::connector::Connector::tracing, ())) - .doc("Log every packet sent or received by any module.\n" - "There are three different tracing levels:\n" - "\n" - " NO_TRACING don't output any tracing information\n" - " TRACE_IDS trace packet id's but do not show packet contents\n" - " TRACE_CONTENTS trace complete packet contents\n" - "\n" - "A log message is generated whenever the packet traverses a connector. The\n" - "TRACE_IDS log message has the following format:\n" - "\n" - " PPI packet trace: \n" - " on connector \n" - " PPI throttling trace: \n" - " on connector \n" - "\n" - "The fields are:\n" - "\n" - " direction 'IN' for packets/throttle notifications entering the module,\n" - " 'OUT' for packets/throttle notifications leaving it\n" - " packet-id Numeric unique packet id. This value is unique for packets\n" - " alive at the same time, packets at different times may (and\n" - " will) share id's\n" - " packet-type The type of the packet header\n" - " module-id Unique module id\n" - " module-type Type of the module the packet is sent to/from\n" - " connector-id Unique connector id\n" - " throttle-msg Type of throttling event\n"); + .add("tracing", senf::console::factory::Command( + SENF_FNP(senf::ppi::connector::Connector::TraceState, + senf::ppi::connector::Connector::tracing, ())) + .doc("Log every packet sent or received by any module.\n" + "There are three different tracing levels:\n" + "\n" + " NO_TRACING don't output any tracing information\n" + " TRACE_IDS trace packet id's but do not show packet contents\n" + " TRACE_CONTENTS trace complete packet contents\n" + "\n" + "A log message is generated whenever the packet traverses a connector. The\n" + "TRACE_IDS log message has the following format:\n" + "\n" + " PPI packet trace: \n" + " on connector \n" + " PPI throttling trace: \n" + " on connector \n" + "\n" + "The fields are:\n" + "\n" + " direction 'IN' for packets/throttle notifications entering the module,\n" + " 'OUT' for packets/throttle notifications leaving it\n" + " packet-id Numeric unique packet id. This value is unique for packets\n" + " alive at the same time, packets at different times may (and\n" + " will) share id's\n" + " packet-type The type of the packet header\n" + " module-id Unique module id\n" + " module-type Type of the module the packet is sent to/from\n" + " connector-id Unique connector id\n" + " throttle-msg Type of throttling event\n") + ); senf::ppi::ModuleManager::instance().consoleDir() - .add("tracing", SENF_FNP(void, senf::ppi::connector::Connector::tracing, - (senf::ppi::connector::Connector::TraceState))) - .arg("state", "new tracing state"); + .add("tracing", senf::console::factory::Command( + SENF_FNP(void, senf::ppi::connector::Connector::tracing, + (senf::ppi::connector::Connector::TraceState))) + .arg("state", "new tracing state") + ); } ConsoleRegister consoleRegister; @@ -165,6 +169,7 @@ prefix_ void senf::ppi::connector::Connector::disconnect() // Cannot disconnected a non-connected connector SENF_ASSERT( peer_ && "senf::ppi::connector::Connector::disconnect(): Not connected" ); + Connector & peer (*peer_); peer_ = 0; peer.peer_ = 0; @@ -173,6 +178,9 @@ prefix_ void senf::ppi::connector::Connector::disconnect() enqueueInitializable(); if (! peer.initializationScheduled()) peer.enqueueInitializable(); + + v_disconnected(); + peer.v_disconnected(); } prefix_ std::type_info const & senf::ppi::connector::Connector::packetTypeID() @@ -180,6 +188,10 @@ prefix_ std::type_info const & senf::ppi::connector::Connector::packetTypeID() return typeid(void); } +prefix_ void senf::ppi::connector::Connector::v_disconnected() + const +{} + /////////////////////////////////////////////////////////////////////////// // senf::ppi::connector::PassiveConnector @@ -260,6 +272,13 @@ prefix_ void senf::ppi::connector::ActiveConnector::registerRoute(ForwardingRout notifyRoutes_.push_back(&route); } +prefix_ void senf::ppi::connector::ActiveConnector::unregisterRoute(ForwardingRoute & route) +{ + NotifyRoutes::iterator i (std::find(notifyRoutes_.begin(), notifyRoutes_.end(), &route)); + if (i != notifyRoutes_.end()) + notifyRoutes_.erase(i); +} + /////////////////////////////////////////////////////////////////////////// // senf::ppi::connector::InputConnector