Fix a problem with iface::cleanup() where 'it' was incremented improperly

This commit is contained in:
Daniel Adolfsson 2012-02-07 22:28:53 +01:00
parent 0dbc3e288a
commit b3e45caf20
3 changed files with 10 additions and 7 deletions

View File

@ -492,9 +492,10 @@ void iface::add_session(const ptr<session>& se)
void iface::cleanup() void iface::cleanup()
{ {
for (std::map<std::string, weak_ptr<iface> >::iterator it = _map.begin(); for (std::map<std::string, weak_ptr<iface> >::iterator it = _map.begin();
it != _map.end(); it++) { it != _map.end(); ) {
if (!it->second) { std::map<std::string, weak_ptr<iface> >::iterator c_it = it++;
_map.erase(it); if (!c_it->second) {
_map.erase(c_it);
} }
} }
} }

View File

@ -107,19 +107,19 @@ logger logger::notice()
logger& logger::operator<<(const std::string& str) logger& logger::operator<<(const std::string& str)
{ {
_ss << str; _ss << str;
return* this; return *this;
} }
logger& logger::operator<<(int n) logger& logger::operator<<(int n)
{ {
_ss << n; _ss << n;
return* this; return *this;
} }
logger& logger::operator<<(logger& (*pf)(logger& )) logger& logger::operator<<(logger& (*pf)(logger& ))
{ {
pf(*this); pf(*this);
return* this; return *this;
} }
logger& logger::endl(logger& __l) logger& logger::endl(logger& __l)
@ -131,7 +131,7 @@ logger& logger::endl(logger& __l)
logger& logger::force_log(bool b) logger& logger::force_log(bool b)
{ {
_force_log = b; _force_log = b;
return* this; return *this;
} }
void logger::flush() void logger::flush()

View File

@ -83,6 +83,8 @@ void route::load(const std::string& path)
{ {
_routes.clear(); _routes.clear();
logger::debug() << "reading routes";
try { try {
std::ifstream ifs; std::ifstream ifs;
ifs.exceptions(std::ifstream::badbit | std::ifstream::failbit); ifs.exceptions(std::ifstream::badbit | std::ifstream::failbit);