'tickets' can use 'threads' now
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@706 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -107,6 +107,6 @@ LastTab::iterator i = FindNotLoggedOut(user_id, session_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "LC: there is no such a user to log out" << logend;
|
||||
log << log4 << "LC: there is no such a user to log out" << logend;
|
||||
}
|
||||
}
|
||||
|
@@ -18,14 +18,13 @@
|
||||
|
||||
Mounts::Mounts()
|
||||
{
|
||||
pmount = 0;
|
||||
pmount = &empty_mount;
|
||||
}
|
||||
|
||||
|
||||
void Mounts::CreateMountType()
|
||||
{
|
||||
mount_type_cms = AddMountType(L"cms");
|
||||
mount_type_thread = AddMountType(L"thread");
|
||||
mount_type_cms = AddMountType(L"cms");
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +38,8 @@ void Mounts::CreateMountFs()
|
||||
void Mounts::CreateMountPar()
|
||||
{
|
||||
mount_par_page = AddMountPar(L"page");
|
||||
mount_par_thread = AddMountPar(L"thread");
|
||||
mount_par_createthread_on = AddMountPar(L"createthread_on");
|
||||
//mount_par_thread = AddMountPar(L"thread");
|
||||
//mount_par_createthread_on = AddMountPar(L"createthread_on");
|
||||
mount_par_only_root_remove = AddMountPar(L"only_root_remove");
|
||||
mount_par_emacs_on = AddMountPar(L"emacs_on");
|
||||
mount_par_mkdir_on = AddMountPar(L"mkdir_on");
|
||||
@@ -56,6 +55,9 @@ void Mounts::CreateMounts()
|
||||
CreateMountPar();
|
||||
|
||||
plugin.Call(WINIX_ADD_MOUNTS);
|
||||
|
||||
empty_mount.param.resize(mount_par_tab.size());
|
||||
empty_mount.ClearParams();
|
||||
}
|
||||
|
||||
|
||||
@@ -246,6 +248,8 @@ void Mounts::CalcCurMount()
|
||||
{
|
||||
std::vector<Item*>::reverse_iterator i;
|
||||
|
||||
pmount = &empty_mount;
|
||||
|
||||
// when the program starts (when the dir_tab is empty()
|
||||
// we don't want to call MountCmsForRoot()
|
||||
if( request->dir_tab.empty() )
|
||||
|
@@ -37,7 +37,6 @@ public:
|
||||
|
||||
// id of a specific mount type (the id is always valid)
|
||||
int MountTypeCms() { return mount_type_cms; }
|
||||
int MountTypeThread() { return mount_type_thread; }
|
||||
|
||||
// return -1 if there is no such a mount type
|
||||
// or index otherwhise
|
||||
@@ -64,8 +63,8 @@ public:
|
||||
const std::wstring & GetMountPar(int id);
|
||||
|
||||
int MountParPage() { return mount_par_page; }
|
||||
int MountParThread() { return mount_par_thread; }
|
||||
int MountParCreatethreadOn() { return mount_par_createthread_on; }
|
||||
//int MountParThread() { return mount_par_thread; }
|
||||
//int MountParCreatethreadOn() { return mount_par_createthread_on; }
|
||||
int MountParOnlyRootRemove() { return mount_par_only_root_remove; }
|
||||
int MountParEmacsOn() { return mount_par_emacs_on; }
|
||||
int MountParMkdirOn() { return mount_par_mkdir_on; }
|
||||
@@ -102,16 +101,14 @@ private:
|
||||
Dirs * dirs;
|
||||
Request * request;
|
||||
|
||||
Mount empty_mount;
|
||||
const std::wstring empty_str;
|
||||
|
||||
MountParser mount_parser;
|
||||
|
||||
// cms
|
||||
// thread
|
||||
std::vector<std::wstring> mount_type_tab;
|
||||
|
||||
int mount_type_cms;
|
||||
int mount_type_thread;
|
||||
|
||||
// simplefs
|
||||
// hashfs
|
||||
@@ -120,13 +117,11 @@ private:
|
||||
int mount_fs_simplefs;
|
||||
int mount_fs_hashfs;
|
||||
|
||||
// page
|
||||
// thread
|
||||
std::vector<std::wstring> mount_par_tab;
|
||||
|
||||
int mount_par_page;
|
||||
int mount_par_thread;
|
||||
int mount_par_createthread_on;
|
||||
//int mount_par_thread;
|
||||
//int mount_par_createthread_on;
|
||||
int mount_par_only_root_remove;
|
||||
int mount_par_emacs_on;
|
||||
int mount_par_mkdir_on;
|
||||
|
@@ -31,8 +31,7 @@ size_t i;
|
||||
|
||||
Plugin::Plugin()
|
||||
{
|
||||
current_plugin = -1;
|
||||
request = 0;
|
||||
current_plugin = -1;
|
||||
|
||||
db = 0;
|
||||
config = 0;
|
||||
@@ -42,6 +41,9 @@ Plugin::Plugin()
|
||||
templates = 0;
|
||||
synchro = 0;
|
||||
session_manager = 0;
|
||||
|
||||
ret_false = 0;
|
||||
ret_true = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -284,10 +286,17 @@ void Plugin::Call(int message, Slots::iterator & slot)
|
||||
|
||||
|
||||
|
||||
|
||||
void Plugin::Call(int message, void * p1_, void * p2_, long l1_, long l2_)
|
||||
{
|
||||
// how many plugins return 'false' and 'true'
|
||||
// we are using local variables because Call() method can be called
|
||||
// from a plugin too (one Call() can execute another Call())
|
||||
int ret_false_loc = 0;
|
||||
int ret_true_loc = 0;
|
||||
int old_current_plugin = current_plugin;
|
||||
|
||||
Slots::iterator i = slots.lower_bound(message);
|
||||
int old_current_plugin = current_plugin;
|
||||
|
||||
for( ; i!=slots.end() && i->first==message ; ++i )
|
||||
{
|
||||
@@ -298,9 +307,16 @@ void Plugin::Call(int message, void * p1_, void * p2_, long l1_, long l2_)
|
||||
info.l2 = l2_;
|
||||
|
||||
Call(message, i);
|
||||
|
||||
if( info.res )
|
||||
++ret_true_loc;
|
||||
else
|
||||
++ret_false_loc;
|
||||
}
|
||||
|
||||
current_plugin = old_current_plugin;
|
||||
ret_false = ret_false_loc;
|
||||
ret_true = ret_true_loc;
|
||||
}
|
||||
|
||||
|
||||
@@ -352,8 +368,6 @@ void Plugin::Call(int message, void * p1_, void * p2_, long l1_)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
size_t Plugin::Size()
|
||||
{
|
||||
return plugins.size();
|
||||
@@ -361,6 +375,19 @@ size_t Plugin::Size()
|
||||
|
||||
|
||||
|
||||
int Plugin::True()
|
||||
{
|
||||
return ret_true;
|
||||
}
|
||||
|
||||
|
||||
int Plugin::False()
|
||||
{
|
||||
return ret_false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Plugin::Assign(int message, Fun1 fun1)
|
||||
{
|
||||
Slot s;
|
||||
|
@@ -74,7 +74,7 @@ struct PluginInfo
|
||||
|
||||
// function return status
|
||||
// default: false (if not set by the plugin)
|
||||
bool ret;
|
||||
bool res;
|
||||
|
||||
|
||||
void Clear()
|
||||
@@ -89,7 +89,7 @@ struct PluginInfo
|
||||
plugin_id = -1;
|
||||
plugin_data_base = 0;
|
||||
|
||||
ret = false;
|
||||
res = false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -161,6 +161,14 @@ public:
|
||||
// how many plugins there are
|
||||
size_t Size();
|
||||
|
||||
// how many plugins returned 'true'
|
||||
// from last Call()
|
||||
int True();
|
||||
|
||||
// how many plugins returned 'false'
|
||||
// from last Call()
|
||||
int False();
|
||||
|
||||
// assign a function to a message
|
||||
// you can assign more than one function to a specific message
|
||||
void Assign(int message, Fun1);
|
||||
@@ -177,6 +185,9 @@ private:
|
||||
Synchro * synchro;
|
||||
SessionManager * session_manager;
|
||||
|
||||
int ret_false;
|
||||
int ret_true;
|
||||
|
||||
std::wstring temp_path;
|
||||
|
||||
struct PluginsItem
|
||||
|
@@ -93,4 +93,13 @@
|
||||
#define WINIX_NOTIFY_ADD_TEMPLATE 3013
|
||||
|
||||
|
||||
|
||||
// values from 4000 - 4099 reserved for 'thread' plugin
|
||||
// see plugins/thread/pluginmsg.h
|
||||
|
||||
// values from 4100 - 4199 reserved for 'ticket' plugin
|
||||
// see plugins/ticket/pluginmsg.h
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -50,8 +50,6 @@ void Request::ClearPostFileTmp()
|
||||
|
||||
void Request::Clear()
|
||||
{
|
||||
// warning: don't clear: in, out, err, env
|
||||
|
||||
// id is never 0
|
||||
if( ++id == 0 )
|
||||
++id;
|
||||
@@ -80,15 +78,16 @@ void Request::Clear()
|
||||
env_content_type = &char_empty;
|
||||
env_http_accept_encoding = &char_empty;
|
||||
|
||||
|
||||
session = 0;
|
||||
temporary_session.Clear();
|
||||
temporary_session.id = 0;
|
||||
session = &temporary_session;
|
||||
|
||||
item_tab.clear();
|
||||
item.Clear();
|
||||
dir_tab.clear();
|
||||
last_item = 0;
|
||||
last_item = &item;
|
||||
is_item = false;
|
||||
function = 0;
|
||||
function = 0; // !! dodac jakas empty funkcje
|
||||
param_tab.clear();
|
||||
|
||||
status = WINIX_ERR_OK;
|
||||
|
@@ -138,6 +138,9 @@ private:
|
||||
|
||||
Config * config;
|
||||
|
||||
// session with id 0
|
||||
Session temporary_session;
|
||||
|
||||
void ClearPostFileTmp();
|
||||
|
||||
// contains '\0'
|
||||
|
@@ -151,7 +151,8 @@ IndexId::iterator i;
|
||||
if( i == index_id.end() )
|
||||
{
|
||||
i = index_id.begin();
|
||||
WaitForSignalSleep(30);
|
||||
WaitForSignalSleep(10);
|
||||
//WaitForSignalSleep(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -186,19 +187,24 @@ return outdated;
|
||||
// it's called from the other thread (with Lock and Unlock)
|
||||
void SessionContainer::DeleteSession(SessionContainer::IndexId::iterator i)
|
||||
{
|
||||
Session * old_session = request->session;
|
||||
Session * old_session = 0;
|
||||
Session * del_session = &(*i->second);
|
||||
|
||||
request->session = &(*i->second);
|
||||
if( del_session != request->session )
|
||||
old_session = request->session;
|
||||
|
||||
//log << log3 << "SessionContainer: deleting outdated session, id: " << i->second->id << logend;
|
||||
request->session = del_session;
|
||||
|
||||
if( i->second->puser )
|
||||
last_container->UserLogout(i->second->puser->id, i->second->id);
|
||||
log << log4 << "SessionContainer: deleting outdated session, id: " << del_session->id << logend;
|
||||
|
||||
if( del_session->puser )
|
||||
last_container->UserLogout(del_session->puser->id, del_session->id);
|
||||
|
||||
table.erase(i->second);
|
||||
index_id.erase(i);
|
||||
table_size -= 1;
|
||||
|
||||
// !! tu moze byc zero
|
||||
request->session = old_session;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user