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()
{
for (std::map<std::string, weak_ptr<iface> >::iterator it = _map.begin();
it != _map.end(); it++) {
if (!it->second) {
_map.erase(it);
it != _map.end(); ) {
std::map<std::string, weak_ptr<iface> >::iterator c_it = 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)
{
_ss << str;
return* this;
return *this;
}
logger& logger::operator<<(int n)
{
_ss << n;
return* this;
return *this;
}
logger& logger::operator<<(logger& (*pf)(logger& ))
{
pf(*this);
return* this;
return *this;
}
logger& logger::endl(logger& __l)
@ -131,7 +131,7 @@ logger& logger::endl(logger& __l)
logger& logger::force_log(bool b)
{
_force_log = b;
return* this;
return *this;
}
void logger::flush()

View File

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