Remove dynamic exceptions
[anna.git] / source / ldap / internal / Timer.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #include <anna/core/tracing/Logger.hpp>
10 #include <anna/core/mt/Guard.hpp>
11
12 #include <anna/ldap/internal/Timer.hpp>
13 #include <anna/ldap/Response.hpp>
14 #include <anna/ldap/Session.hpp>
15
16 using namespace std;
17 using namespace anna;
18
19 void ldap::Timer::expire(timex::Engine*)
20 noexcept(false) {
21   Response* response = getResponse();
22   Session* session = response->getSession();
23   Guard guard(session, "anna::ldap::Timer::expire");
24   LOGDEBUG(
25     string msg("anna::ldap::Timer::expire | ");
26     msg += response->asString();
27     Logger::debug(msg, ANNA_FILE_LOCATION);
28   );
29   session->expireResponse(response);
30 }
31
32 string ldap::Timer::asString() const
33 {
34   const Response* response = getResponse();
35   string result("anna::ldap::Timer { ");
36   result += timex::Transaction::asString();
37
38   if(response != NULL) {
39     result += " | ";
40     result += response->asString();
41   } else
42     result += " | Response: <null>";
43
44   return result += " }";
45 }