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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user