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) 2009-2021, Tomasz Sowa
* Copyright (c) 2009-2022, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@
#include "log.h"
#include "db/db.h"
#include "cur.h"
#include "dirs.h"
@@ -49,6 +50,7 @@ Mounts::Mounts()
{
pmount = &empty_mount;
skip_static = false;
dirs = nullptr;
}
@@ -99,7 +101,7 @@ void Mounts::CreateMounts()
CreateMountFs();
CreateMountPar();
plugin->Call((Session*)0, WINIX_ADD_MOUNTS);
plugin->Call(WINIX_ADD_MOUNTS);
empty_mount.param.resize(mount_par_tab.size());
empty_mount.ClearParams();
@@ -118,12 +120,6 @@ void Mounts::SetDb(Db * pdb)
db = pdb;
}
void Mounts::SetCur(Cur * pcur)
{
cur = pcur;
}
int Mounts::AddMountType(const wchar_t * type)
{
@@ -221,13 +217,11 @@ void Mounts::ReadMounts(const std::wstring & mounts)
mount_parser.Parse(mounts, mount_tab);
CalcCurMount();
// IMPROVE ME
// cur->mount is pointing to the empty mount (it is set in functions.cpp in CheckSpecialFile method)
// may would be better to call WINIX_FSTAB_CHANGED after the cur->mount is set?
// some plugins are using 'cur' object
plugin->Call((Session*)0, WINIX_FSTAB_CHANGED);
plugin->Call(WINIX_FSTAB_CHANGED);
}
@@ -292,7 +286,7 @@ void Mounts::MountCmsForRoot()
Mount * Mounts::CalcCurMount()
Mount * Mounts::CalcCurMount(Request * request)
{
std::vector<Item*>::reverse_iterator i;
@@ -300,10 +294,10 @@ std::vector<Item*>::reverse_iterator i;
// when the program starts (when the dir_tab is empty()
// we don't want to call MountCmsForRoot()
if( cur->request->dir_tab.empty() )
if( request->dir_tab.empty() )
return pmount;
for(i = cur->request->dir_tab.rbegin() ; i!=cur->request->dir_tab.rend() ; ++i)
for(i = request->dir_tab.rbegin() ; i!=request->dir_tab.rend() ; ++i)
{
std::map<long, Mount>::iterator m = mount_tab.find( (*i)->id );