fix: correctly clear after a request when an exception has been thrown
This commit is contained in:
parent
dda325bbbf
commit
1655ae3562
|
@ -766,25 +766,12 @@ void App::ProcessRequestThrow()
|
||||||
|
|
||||||
void App::ProcessRequest()
|
void App::ProcessRequest()
|
||||||
{
|
{
|
||||||
|
system.load_avg.StartRequest(cur.request);
|
||||||
|
log << log2 << config.log_delimiter << logend;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
system.load_avg.StartRequest(cur.request);
|
|
||||||
log << log2 << config.log_delimiter << logend;
|
|
||||||
|
|
||||||
ProcessRequestThrow();
|
ProcessRequestThrow();
|
||||||
|
|
||||||
if( cur.request->run_state == Request::RunState::normal_run )
|
|
||||||
{
|
|
||||||
cur.request->FinishRequest();
|
|
||||||
system.load_avg.StopRequest(cur.request);
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveSessionsIfNeeded();
|
|
||||||
|
|
||||||
if( cur.request->run_state == Request::RunState::finished )
|
|
||||||
{
|
|
||||||
ClearAfterRequest();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(const std::exception & e)
|
catch(const std::exception & e)
|
||||||
{
|
{
|
||||||
|
@ -798,26 +785,28 @@ void App::ProcessRequest()
|
||||||
{
|
{
|
||||||
log << log1 << "App: there was an unknown exception" << logend;
|
log << log1 << "App: there was an unknown exception" << logend;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void App::ClearAfterRequest()
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// simple operations which should not throw an exception
|
if( cur.request->run_state == Request::RunState::normal_run )
|
||||||
cur.request->Clear();
|
{
|
||||||
cur.session->ClearAfterRequest();
|
cur.request->FinishRequest();
|
||||||
cur.session = session_manager.GetTmpSession();
|
system.load_avg.StopRequest(cur.request);
|
||||||
cur.mount = system.mounts.GetEmptyMount();
|
}
|
||||||
system.mounts.pmount = cur.mount; // IMPROVE ME system.mounts.pmount will be removed
|
|
||||||
// send_data_buf doesn't have to be cleared and it is better to not clear it (optimizing)
|
|
||||||
|
|
||||||
model_connector.set_winix_request(nullptr);
|
SaveSessionsIfNeeded();
|
||||||
model_connector.set_winix_session(nullptr);
|
}
|
||||||
model_connector.set_winix_session_logger(nullptr);
|
catch(...)
|
||||||
|
{
|
||||||
|
log << log1 << "App: an exception when finishing a request" << logend;
|
||||||
|
}
|
||||||
|
|
||||||
log << logendrequest;
|
try
|
||||||
|
{
|
||||||
|
if( cur.request->run_state == Request::RunState::finished )
|
||||||
|
{
|
||||||
|
ClearAfterRequest();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
|
@ -826,6 +815,24 @@ void App::ClearAfterRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void App::ClearAfterRequest()
|
||||||
|
{
|
||||||
|
// simple operations which should not throw an exception
|
||||||
|
cur.request->Clear();
|
||||||
|
cur.session->ClearAfterRequest();
|
||||||
|
cur.session = session_manager.GetTmpSession();
|
||||||
|
cur.mount = system.mounts.GetEmptyMount();
|
||||||
|
system.mounts.pmount = cur.mount; // IMPROVE ME system.mounts.pmount will be removed
|
||||||
|
// send_data_buf doesn't have to be cleared and it is better to not clear it (optimizing)
|
||||||
|
|
||||||
|
model_connector.set_winix_request(nullptr);
|
||||||
|
model_connector.set_winix_session(nullptr);
|
||||||
|
model_connector.set_winix_session_logger(nullptr);
|
||||||
|
|
||||||
|
log << logendrequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool App::InitializeRequestForFastCGI(Request & request)
|
bool App::InitializeRequestForFastCGI(Request & request)
|
||||||
{
|
{
|
||||||
bool request_initialized = false;
|
bool request_initialized = false;
|
||||||
|
|
Loading…
Reference in New Issue