mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 19:14:30 -04:00
Update QtWebapp to 1.7.11
This commit is contained in:
20
third_party/QtWebApp/httpserver/httpsession.cpp
vendored
20
third_party/QtWebApp/httpserver/httpsession.cpp
vendored
@ -7,6 +7,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QUuid>
|
||||
|
||||
using namespace stefanfrings;
|
||||
|
||||
HttpSession::HttpSession(bool canStore)
|
||||
{
|
||||
@ -17,7 +18,7 @@ HttpSession::HttpSession(bool canStore)
|
||||
dataPtr->lastAccess=QDateTime::currentMSecsSinceEpoch();
|
||||
dataPtr->id=QUuid::createUuid().toString().toLocal8Bit();
|
||||
#ifdef SUPERVERBOSE
|
||||
qDebug("HttpSession: created new session data with id %s",dataPtr->id.data());
|
||||
qDebug("HttpSession: (constructor) new session %s with refCount=1",dataPtr->id.constData());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -34,7 +35,7 @@ HttpSession::HttpSession(const HttpSession& other)
|
||||
dataPtr->lock.lockForWrite();
|
||||
dataPtr->refCount++;
|
||||
#ifdef SUPERVERBOSE
|
||||
qDebug("HttpSession: refCount of %s is %i",dataPtr->id.data(),dataPtr->refCount);
|
||||
qDebug("HttpSession: (constructor) copy session %s refCount=%i",dataPtr->id.constData(),dataPtr->refCount);
|
||||
#endif
|
||||
dataPtr->lock.unlock();
|
||||
}
|
||||
@ -49,7 +50,7 @@ HttpSession& HttpSession::operator= (const HttpSession& other)
|
||||
dataPtr->lock.lockForWrite();
|
||||
dataPtr->refCount++;
|
||||
#ifdef SUPERVERBOSE
|
||||
qDebug("HttpSession: refCount of %s is %i",dataPtr->id.data(),dataPtr->refCount);
|
||||
qDebug("HttpSession: (operator=) session %s refCount=%i",dataPtr->id.constData(),dataPtr->refCount);
|
||||
#endif
|
||||
dataPtr->lastAccess=QDateTime::currentMSecsSinceEpoch();
|
||||
dataPtr->lock.unlock();
|
||||
@ -57,14 +58,15 @@ HttpSession& HttpSession::operator= (const HttpSession& other)
|
||||
if (oldPtr)
|
||||
{
|
||||
int refCount;
|
||||
oldPtr->lock.lockForRead();
|
||||
refCount=oldPtr->refCount--;
|
||||
oldPtr->lock.lockForWrite();
|
||||
refCount=--oldPtr->refCount;
|
||||
#ifdef SUPERVERBOSE
|
||||
qDebug("HttpSession: refCount of %s is %i",oldPtr->id.data(),oldPtr->refCount);
|
||||
qDebug("HttpSession: (operator=) session %s refCount=%i",oldPtr->id.constData(),oldPtr->refCount);
|
||||
#endif
|
||||
oldPtr->lock.unlock();
|
||||
if (refCount==0)
|
||||
{
|
||||
qDebug("HttpSession: deleting old data");
|
||||
delete oldPtr;
|
||||
}
|
||||
}
|
||||
@ -75,10 +77,10 @@ HttpSession::~HttpSession()
|
||||
{
|
||||
if (dataPtr) {
|
||||
int refCount;
|
||||
dataPtr->lock.lockForRead();
|
||||
dataPtr->lock.lockForWrite();
|
||||
refCount=--dataPtr->refCount;
|
||||
#ifdef SUPERVERBOSE
|
||||
qDebug("HttpSession: refCount of %s is %i",dataPtr->id.data(),dataPtr->refCount);
|
||||
qDebug("HttpSession: (destructor) session %s refCount=%i",dataPtr->id.constData(),dataPtr->refCount);
|
||||
#endif
|
||||
dataPtr->lock.unlock();
|
||||
if (refCount==0)
|
||||
@ -179,7 +181,7 @@ void HttpSession::setLastAccess()
|
||||
{
|
||||
if (dataPtr)
|
||||
{
|
||||
dataPtr->lock.lockForRead();
|
||||
dataPtr->lock.lockForWrite();
|
||||
dataPtr->lastAccess=QDateTime::currentMSecsSinceEpoch();
|
||||
dataPtr->lock.unlock();
|
||||
}
|
||||
|
Reference in New Issue
Block a user