Browse Source

Correct exceptions handling --- prevent from server go down

master
Artyom Beilis 16 years ago
parent
commit
f274d530ec
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      tcp_cache_server.cpp

+ 12
- 1
tcp_cache_server.cpp View File

@@ -237,7 +237,18 @@ int main(int argc,char **argv)
aio::io_service io;
thread_cache cache(atoi(argv[3]));
tcp_cache_server srv_cache(io,argv[1],atoi(argv[2]),cache);
io.run();
for(;;) {
try {
io.run();
break;
}
catch(cppcms_error const &e) {
// Not much to do...
// Object will be destroyed automatically
// Because it does not resubmit itself
cerr<<"CppCMS Error:"<<e.what()<<endl;
}
}
}
catch(std::exception const &e) {
cerr<<"Error:"<<e.what()<<endl;


Loading…
Cancel
Save