allow a request to be processed in a job

Now we allow a request to be passed into a job queue,
and after the job finishes the request is passed into
a controller again. In order to achieve this we have
a requests queue in System, when we put a request
to the job this Request structure is preserved in the
queue and for a new request a new Request is added to
the queue.

while here:
- remove App::Lock()/Unlock(), use scoped locking
- fix: Plugin now has a Call method which takes ModelConnector
  and a logger (used in multithreaded environment)
- BaseThread has a main_model_connector pointer
  to the main (from the main thread) model connector
- the FastCGI structure fcgi_request moved from App to Request
- some methods for handling requests moved from App to Request
- small refactoring in main.cpp
- add Http class (a http client)
This commit is contained in:
2022-07-25 14:21:21 +02:00
parent b2d92b85a0
commit 979ef907fe
65 changed files with 7018 additions and 4437 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2018, Tomasz Sowa
* Copyright (c) 2010-2022, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -149,16 +149,19 @@ StatsSession * stats_session = 0;
void SessionCreated(PluginInfo & info)
void SessionCreated(PluginInfo & env)
{
StatsSession * d = new StatsSession();
info.session->plugin_data.Assign(info.plugin->current_plugin, d);
if( !info.cur->request->IsParam(nostat_param) )
if( env.cur->session )
{
info.log << log4 << "Stats: created stats plugin data"
<< ", plugin id: " << info.plugin_id
<< ", pointer: " << d << logend;
StatsSession * d = new StatsSession();
env.cur->session->plugin_data.Assign(env.plugin->current_plugin, d);
if( !env.cur->request->IsParam(nostat_param) )
{
env.log << log4 << "Stats: created stats plugin data"
<< ", plugin id: " << env.plugin_id
<< ", pointer: " << d << logend;
}
}
}
@@ -170,7 +173,11 @@ void RemoveSession(PluginInfo & info)
{
// temporarily for debug
// sometimes the pointer is null here
info.log << log1 << "Stats: why the info.plugin_data_base is zero? !!!!, ses_id: " << info.session->id << logend;
if( info.cur->session )
{
info.log << log1 << "Stats: why the info.plugin_data_base is zero? !!!!, ses_id: " << info.cur->session->id << logend;
}
return;
}
@@ -230,11 +237,12 @@ using namespace Stats;
info.plugin->Assign(WINIX_CONTENT_MAKE, ContentMake);
info.plugin->Assign(WINIX_SESSION_CREATED, SessionCreated);
info.plugin->Assign(WINIX_PLUGIN_SESSION_DATA_REMOVE, RemoveSession);
info.plugin->Assign(WINIX_PREPARE_TO_CLOSE, Close);
info.plugin->Assign(WINIX_PREPARE_TO_CLOSE, Close);
info.plugin->Assign(WINIX_FILE_REMOVED, RemoveFile);
info.plugin->Assign(WINIX_DIR_PREPARE_TO_REMOVE, RemoveDir);
info.set_dependency_for(stats);
stats.set_dependency((WinixModelDeprecated*)info.functions);
stats.ReadConfig(info.config);
stats.ReadStats();