Now only unwiring if the NDP proxy did the wiring in the first place
This commit is contained in:
parent
701476417a
commit
55ad4b11f0
@ -78,14 +78,17 @@ void session::update_all(int elapsed_time)
|
|||||||
session::~session()
|
session::~session()
|
||||||
{
|
{
|
||||||
logger::debug() << "session::~session() this=" << logger::format("%x", this);
|
logger::debug() << "session::~session() this=" << logger::format("%x", this);
|
||||||
|
|
||||||
|
if (_wired == true) {
|
||||||
|
for (std::list<ptr<iface> >::iterator it = _ifaces.begin();
|
||||||
|
it != _ifaces.end(); it++) {
|
||||||
|
handle_auto_unwire((*it));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (std::list<ptr<iface> >::iterator it = _ifaces.begin();
|
for (std::list<ptr<iface> >::iterator it = _ifaces.begin();
|
||||||
it != _ifaces.end(); it++)
|
it != _ifaces.end(); it++)
|
||||||
{
|
{
|
||||||
if (_autowire == true) {
|
|
||||||
handle_auto_unwire((*it));
|
|
||||||
}
|
|
||||||
|
|
||||||
(*it)->remove_session(_ptr);
|
(*it)->remove_session(_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,14 +98,15 @@ ptr<session> session::create(const ptr<proxy>& pr, const address& saddr,
|
|||||||
{
|
{
|
||||||
ptr<session> se(new session());
|
ptr<session> se(new session());
|
||||||
|
|
||||||
se->_ptr = se;
|
se->_ptr = se;
|
||||||
se->_pr = pr;
|
se->_pr = pr;
|
||||||
se->_saddr = address("::") == saddr ? all_nodes : saddr;
|
se->_saddr = address("::") == saddr ? all_nodes : saddr;
|
||||||
se->_taddr = taddr;
|
se->_taddr = taddr;
|
||||||
se->_daddr = daddr;
|
se->_daddr = daddr;
|
||||||
se->_autowire = auto_wire;
|
se->_autowire = auto_wire;
|
||||||
se->_ttl = pr->timeout();
|
se->_wired = false;
|
||||||
se->_touched = true;
|
se->_ttl = pr->timeout();
|
||||||
|
se->_touched = true;
|
||||||
|
|
||||||
_sessions.push_back(se);
|
_sessions.push_back(se);
|
||||||
|
|
||||||
@ -161,6 +165,8 @@ void session::handle_auto_wire(const ptr<iface>& ifa)
|
|||||||
<< "session::system(" << route_cmd.str() << ")";
|
<< "session::system(" << route_cmd.str() << ")";
|
||||||
|
|
||||||
system(route_cmd.str().c_str());
|
system(route_cmd.str().c_str());
|
||||||
|
|
||||||
|
_wired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void session::handle_auto_unwire(const ptr<iface>& ifa)
|
void session::handle_auto_unwire(const ptr<iface>& ifa)
|
||||||
@ -181,6 +187,8 @@ void session::handle_auto_unwire(const ptr<iface>& ifa)
|
|||||||
<< "session::system(" << route_cmd.str() << ")";
|
<< "session::system(" << route_cmd.str() << ")";
|
||||||
|
|
||||||
system(route_cmd.str().c_str());
|
system(route_cmd.str().c_str());
|
||||||
|
|
||||||
|
_wired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void session::handle_advert(const ptr<iface>& ifa)
|
void session::handle_advert(const ptr<iface>& ifa)
|
||||||
@ -223,6 +231,11 @@ bool session::autowire() const
|
|||||||
return _autowire;
|
return _autowire;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool session::wired() const
|
||||||
|
{
|
||||||
|
return _wired;
|
||||||
|
}
|
||||||
|
|
||||||
bool session::touched() const
|
bool session::touched() const
|
||||||
{
|
{
|
||||||
return _touched;
|
return _touched;
|
||||||
|
@ -34,6 +34,8 @@ private:
|
|||||||
|
|
||||||
bool _autowire;
|
bool _autowire;
|
||||||
|
|
||||||
|
bool _wired;
|
||||||
|
|
||||||
bool _touched;
|
bool _touched;
|
||||||
|
|
||||||
// An array of interfaces this session is monitoring for
|
// An array of interfaces this session is monitoring for
|
||||||
@ -75,6 +77,8 @@ public:
|
|||||||
|
|
||||||
bool autowire() const;
|
bool autowire() const;
|
||||||
|
|
||||||
|
bool wired() const;
|
||||||
|
|
||||||
bool touched() const;
|
bool touched() const;
|
||||||
|
|
||||||
int status() const;
|
int status() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user