fixed: when signal comes winix properly exits

fixed:   when winix exits the session data were not properly destroyed (memory leak)
         we should set request.session pointer to each session when deleting sessions
         from session_container
         the session data were not properly destroyed when winix checked for 
         outdated sessions (and when it was removing them)
fixed:   performance (memcpy used too often)
         in some places there were reserve method used (on std::wstring/std::string objects)
         especially in AssignString() method and TextStream<> object
         if we add a new string we should check the new size
         and only call reserve() if the new size will be greater than existing one
         (plus some constant)
changed: fcgi objects moved to App class (from Request)
         now we use thread safe methods (e.g. FCGX_Accept_r)
added:   log_plugin_call option to the config
         default: false
         when true winix log when a plugin function is called
added:   winix parameter 'nostat' for not calculating statistics
         (useful when making performance tests)


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@680 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-11-23 21:52:25 +00:00
parent 515d4bab0d
commit 518281e101
39 changed files with 483 additions and 339 deletions

View File

@@ -41,15 +41,12 @@ init.o: ../../functions/template.h ../../functions/tinymce.h
init.o: ../../functions/uname.h ../../functions/upload.h
init.o: ../../functions/uptime.h ../../functions/who.h ../../functions/vim.h
init.o: ../../core/htmlfilter.h ../../templates/templates.h
init.o: ../../templates/patterncacher.h ../../core/item.h
init.o: ../../templates/ckeditorgetparser.h ../../core/httpsimpleparser.h
init.o: ../../core/log.h ../../templates/indexpatterns.h
init.o: ../../core/sessionmanager.h statssession.h ../../core/plugindata.h
init.o: ../../templates/patterncacher.h ../../templates/ckeditorgetparser.h
init.o: ../../core/httpsimpleparser.h ../../core/log.h
init.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h
init.o: statssession.h ../../core/plugindata.h
stats.o: stats.h ../../core/config.h ../../core/log.h ../../core/textstream.h
stats.o: ../../core/misc.h ../../core/item.h ../../../ezc/src/ezc.h
stats.o: ../../../ezc/src/utf8.h ../../../ezc/src/generator.h
stats.o: ../../../ezc/src/pattern.h ../../../ezc/src/stringconv.h
stats.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h
stats.o: ../../core/misc.h ../../core/item.h ../../../ezc/src/utf8.h
templates.o: templates.h ../../core/plugin.h ../../core/pluginmsg.h
templates.o: ../../core/log.h ../../core/plugindata.h ../../core/config.h
templates.o: ../../core/confparser.h ../../core/htmlfilter.h
@@ -95,7 +92,7 @@ templates.o: ../../functions/uname.h ../../functions/upload.h
templates.o: ../../functions/uptime.h ../../functions/who.h
templates.o: ../../functions/vim.h ../../core/htmlfilter.h
templates.o: ../../templates/templates.h ../../templates/patterncacher.h
templates.o: ../../core/item.h ../../templates/ckeditorgetparser.h
templates.o: ../../templates/ckeditorgetparser.h
templates.o: ../../core/httpsimpleparser.h ../../core/log.h
templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h
templates.o: ../../core/misc.h stats.h

View File

@@ -20,7 +20,15 @@
extern "C" void Init(PluginInfo &);
const wchar_t plugin_name[] = L"stats";
static const wchar_t plugin_name[] = L"stats";
// if there is a winix function parameter nostat_param used
// such as: http://mysite.com/uptime/nostat
// then the statistics will not be calculated
// and winix will not log about creating and destroying plugins date
// (useful when making performance tests so it not change the real statistics)
static const wchar_t nostat_param[] = L"nostat";
namespace Stats
@@ -87,6 +95,10 @@ StatsSession * stats_session = 0;
return;
stats_session = reinterpret_cast<StatsSession*>(info.plugin_data_base);
stats_session->nostat = info.request->IsParam(nostat_param);
if( stats_session->nostat )
return;
// this simply prevents F5 (refresh) from a webbrowser
if( stats_session->last_visited != -1 &&
@@ -113,18 +125,34 @@ void SessionCreated(PluginInfo & info)
StatsSession * d = new StatsSession();
info.request->session->plugin_data.Assign(d);
log << log3 << "created stats plugin data"
<< ", plugin id: " << info.plugin_id
<< ", pointer: " << d << logend;
if( !info.request->IsParam(nostat_param) )
{
log << log3 << "created stats plugin data"
<< ", plugin id: " << info.plugin_id
<< ", pointer: " << d << logend;
}
}
void RemoveSession(PluginInfo & info)
{
log << log1 << "deleting stats plugin data"
<< ", plugin id: " << info.plugin_id
<< ", pointer: " << info.plugin_data_base << logend;
if( !info.plugin_data_base )
{
// temporarily for debug
// sometimes the pointer is null here
log << log1 << "Stats: why the info.plugin_data_base is zero? !!!!" << logend;
return;
}
StatsSession * d = reinterpret_cast<StatsSession*>(info.plugin_data_base);
if( !d->nostat )
{
log << log3 << "deleting stats plugin data"
<< ", plugin id: " << info.plugin_id
<< ", pointer: " << info.plugin_data_base << logend;
}
delete info.plugin_data_base;
}

View File

@@ -10,7 +10,7 @@
#include <ctime>
#include "stats.h"
#include "core/log.h"
#include "ezc.h"
#include "utf8.h"
namespace Stats

View File

@@ -23,11 +23,13 @@ struct StatsSession : public PluginDataBase
// whether this session has been calculated
bool calculated;
long last_visited;
bool nostat; // is nostat parameter
StatsSession()
{
calculated = false;
last_visited = -1;
nostat = false;
}
};