+return 0;*/
+printfd(__FILE__, "USER::WriteDetailedStat() - queue size = %d\n", traffStatQueue.size());
+
+if (!traffStatQueue.empty())
+ {
+ std::list<std::pair<time_t, TRAFF_STAT> >::iterator it;
+ for (it = traffStatQueue.begin(); it != traffStatQueue.end(); ++it)
+ {
+ if (store->WriteDetailedStat(it->second, it->first, login))
+ {
+ printfd(__FILE__, "USER::WriteDetailStat() - failed to write detail stat from queue\n");
+ WriteServLog("Cannot write detail stat from queue (of size %d recs) for user %s.", traffStatQueue.size(), login.c_str());
+ WriteServLog("%s", store->GetStrError().c_str());
+ return -1;
+ }
+ traffStatQueue.erase(it++);
+ }
+ }
+
+TRAFF_STAT ts;
+
+ {
+ STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+ ts.swap(traffStat);
+ }
+
+printfd(__FILE__, "USER::WriteDetailedStat() - size = %d\n", ts.size());
+
+if (ts.size() && !disabledDetailStat)
+ {
+ if (store->WriteDetailedStat(ts, lastWriteDeatiledStat, login))
+ {
+ printfd(__FILE__, "USER::WriteDetailStat() - failed to write current detail stat\n");
+ WriteServLog("Cannot write detail stat for user %s.", login.c_str());
+ WriteServLog("%s", store->GetStrError().c_str());
+ if (!hard)
+ {
+ printfd(__FILE__, "USER::WriteDetailStat() - pushing detail stat to queue\n");
+ traffStatQueue.push_back(std::make_pair(lastWriteDeatiledStat, ts));
+ }
+ }
+ }
+lastWriteDeatiledStat = stgTime;