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:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2021, Tomasz Sowa
|
||||
* Copyright (c) 2008-2022, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,8 +40,10 @@
|
||||
#include <map>
|
||||
#include "pluginmsg.h"
|
||||
#include "plugindata.h"
|
||||
#include "winixbase.h"
|
||||
#include "winixmodeldeprecated.h"
|
||||
#include "modelconnector.h"
|
||||
#include "mount.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -78,6 +80,7 @@ class WinixRequest;
|
||||
|
||||
class Plugin;
|
||||
class Session;
|
||||
class Request;
|
||||
|
||||
|
||||
// move me to a different file
|
||||
@@ -111,14 +114,6 @@ struct PluginInfo
|
||||
|
||||
morm::ModelConnector * model_connector;
|
||||
|
||||
// a session
|
||||
// some messages are sent in a session's context e.g. logging a user
|
||||
// this pointer in not always the same as cur->session, it is preferred
|
||||
// to use this pointer instead of cur->session
|
||||
// (cur->session can point at a temporary object)
|
||||
// this pointer can be null
|
||||
Session * session;
|
||||
|
||||
// pointer to the plugin session (can be null if not set by the plugin or if session is null)
|
||||
// this is taken from session->plugin_data.Get()
|
||||
// you should use WINIX_SESSION_CREATED and WINIX_PLUGIN_SESSION_DATA_REMOVE
|
||||
@@ -130,13 +125,6 @@ struct PluginInfo
|
||||
bool res;
|
||||
|
||||
|
||||
|
||||
void set_dependency_for(WinixBase * winix_base);
|
||||
void set_dependency_for(WinixBase & winix_base);
|
||||
|
||||
void set_dependency_for(WinixModelDeprecated * winix_model);
|
||||
void set_dependency_for(WinixModelDeprecated & winix_model);
|
||||
|
||||
void Clear()
|
||||
{
|
||||
// pointers to winix objects are not cleared here
|
||||
@@ -147,7 +135,6 @@ struct PluginInfo
|
||||
l2 = 0;
|
||||
|
||||
plugin_id = -1;
|
||||
session = 0;
|
||||
plugin_data_base = 0;
|
||||
|
||||
res = false;
|
||||
@@ -173,11 +160,11 @@ struct PluginRes
|
||||
|
||||
|
||||
|
||||
class Plugin : public WinixBase
|
||||
class Plugin : public WinixModelDeprecated
|
||||
{
|
||||
public:
|
||||
|
||||
// index of a plugin which is called by Call() method
|
||||
// index of a plugin which is called by CallAllRegisteredMessages() method
|
||||
// normally: -1
|
||||
int current_plugin;
|
||||
|
||||
@@ -215,12 +202,10 @@ public:
|
||||
~Plugin();
|
||||
|
||||
void SetDb(Db * pdb);
|
||||
//void SetConfig(Config * pconfig);
|
||||
void SetCur(Cur * pcur);
|
||||
void SetSystem(System * psystem);
|
||||
void SetCur(Cur * cur);
|
||||
void SetFunctions(Functions * pfunctions);
|
||||
void SetTemplates(Templates * ptemplates);
|
||||
//void SetSynchro(Synchro * psynchro);
|
||||
void SetSessionManager(SessionManager * psession_manager);
|
||||
|
||||
void SetWinixRequest(WinixRequest * winix_request);
|
||||
@@ -244,16 +229,9 @@ public:
|
||||
PluginRes Call(int message, void * p1_, long l1_);
|
||||
PluginRes Call(int message, void * p1_, long l1_, long l2_);
|
||||
PluginRes Call(int message, void * p1_, void * p2_, long l1_);
|
||||
PluginRes Call(Session * ses, int message, void * p1_, void * p2_, long l1_, long l2_);
|
||||
|
||||
PluginRes Call(Session * ses, int message);
|
||||
PluginRes Call(Session * ses, int message, void * p1_);
|
||||
PluginRes Call(Session * ses, int message, void * p1_, void * p2_);
|
||||
PluginRes Call(Session * ses, int message, long l1_);
|
||||
PluginRes Call(Session * ses, int message, long l1_, long l2_);
|
||||
PluginRes Call(Session * ses, int message, void * p1_, long l1_);
|
||||
PluginRes Call(Session * ses, int message, void * p1_, long l1_, long l2_);
|
||||
PluginRes Call(Session * ses, int message, void * p1_, void * p2_, long l1_);
|
||||
PluginRes Call(morm::ModelConnector * model_connector, Log * plog, Cur * cur, int message, void * p1 = nullptr, void * p2 = nullptr, long l1 = 0, long l2 = 0);
|
||||
PluginRes Call(morm::ModelConnector * model_connector, Log * plog, Session * session, Request * request, Mount * mount, int message, void * p1 = nullptr, void * p2 = nullptr, long l1 = 0, long l2 = 0);
|
||||
|
||||
// how many plugins there are
|
||||
size_t Size();
|
||||
@@ -269,15 +247,13 @@ public:
|
||||
private:
|
||||
|
||||
Db * db;
|
||||
//Config * config;
|
||||
Cur * cur;
|
||||
System * system;
|
||||
Functions * functions;
|
||||
Templates * templates;
|
||||
//Synchro * synchro;
|
||||
SessionManager * session_manager;
|
||||
|
||||
WinixRequest * winix_request;
|
||||
WinixRequest * winix_request; // is it needed anymore? !!!!!!!!!!!!!!!!
|
||||
|
||||
std::wstring temp_path; // used when loading plugins
|
||||
|
||||
@@ -287,11 +263,10 @@ private:
|
||||
Slots slots;
|
||||
|
||||
void * LoadInitFun(const wchar_t * filename, Fun1 & fun_init);
|
||||
void Call(Session * ses, int message, Slots::iterator & slot, PluginInfo & info);
|
||||
void Call(morm::ModelConnector * model_connector, Log * plog, Cur * cur, int message, Slots::iterator & slot, PluginInfo & info);
|
||||
|
||||
bool SetDependency(PluginInfo & info);
|
||||
void SetDependencyFor(WinixBase * winix_base);
|
||||
void SetDependencyFor(WinixModelDeprecated * winix_model);
|
||||
|
||||
bool SetDependencyForPluginInfo(morm::ModelConnector * pmodel_connector, Log * plog, Cur * pcur, PluginInfo & info);
|
||||
void Lock();
|
||||
void Unlock();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user