Formatting

This commit is contained in:
Klaus Basan
2018-03-19 20:26:06 +01:00
parent 28b270a4cf
commit 011f31ad2b
7 changed files with 30 additions and 23 deletions

View File

@@ -484,6 +484,8 @@ namespace BlackCore
/*!
* We received a reply to one of our queries.
* \sa sendCapabilitiesQuery
* @param callsign
* @param capabilitiesFlags as in BlackMisc::Network::CClient
*/
void capabilitiesReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, int capabilitiesFlags);

View File

@@ -50,14 +50,14 @@ namespace BlackCore
QDateTime CThreadedReader::getUpdateTimestamp() const
{
QReadLocker lock(&this->m_lock);
return this->m_updateTimestamp;
QReadLocker lock(&m_lock);
return m_updateTimestamp;
}
void CThreadedReader::setUpdateTimestamp(const QDateTime &updateTimestamp)
{
QWriteLocker lock(&this->m_lock);
this->m_updateTimestamp = updateTimestamp;
QWriteLocker lock(&m_lock);
m_updateTimestamp = updateTimestamp;
}
bool CThreadedReader::updatedWithinLastMs(qint64 timeLastMs)
@@ -105,31 +105,31 @@ namespace BlackCore
{
uint oldHash = 0;
{
QReadLocker rl(&this->m_lock);
oldHash = this->m_contentHash;
QReadLocker rl(&m_lock);
oldHash = m_contentHash;
}
uint newHash = qHash(startPosition < 0 ? content : content.mid(startPosition));
if (oldHash == newHash) { return false; }
{
QWriteLocker wl(&this->m_lock);
this->m_contentHash = newHash;
QWriteLocker wl(&m_lock);
m_contentHash = newHash;
}
return true;
}
bool CThreadedReader::isMarkedAsFailed() const
{
return this->m_markedAsFailed;
return m_markedAsFailed;
}
void CThreadedReader::setMarkedAsFailed(bool failed)
{
this->m_markedAsFailed = failed;
m_markedAsFailed = failed;
}
CUrlLogList CThreadedReader::getReadLog() const
{
QReadLocker rl(&this->m_lock);
QReadLocker rl(&m_lock);
return m_urlReadLog;
}
@@ -165,15 +165,14 @@ namespace BlackCore
bool CThreadedReader::doWorkCheck() const
{
// sApp->hasWebDataServices() cannot be used, as some readers are already used during init phase
if (!m_unitTest && (!sApp || sApp->isShuttingDown())) { return false; }
if (!isEnabled()) { return false; }
if (isAbandoned()) { return false; }
if (!m_unitTest && (!sApp || sApp->isShuttingDown())) { return false; }
return true;
}
QNetworkReply *CThreadedReader::getFromNetworkAndLog(const CUrl &url, const BlackMisc::CSlot<void (QNetworkReply *)> &callback)
{
// returned QNetworkReply normally nullptr since QAM is in different thread
QWriteLocker wl(&m_lock);
const CUrlLogList outdatedPendingUrls = m_urlReadLog.findOutdatedPending(OutdatedPendingCallMs);
if (!outdatedPendingUrls.isEmpty())
@@ -184,6 +183,8 @@ namespace BlackCore
const int id = m_urlReadLog.addPendingUrl(url);
wl.unlock();
// returned QNetworkReply normally nullptr since QAM is in different thread
return sApp->getFromNetwork(url, id, callback);
}

View File

@@ -139,7 +139,7 @@ namespace BlackCore
int m_periodicTime = -1; //!< Periodic time after which the task is repeated
QDateTime m_updateTimestamp; //!< when file/resource was read
uint m_contentHash = 0; //!< has of the content given
std::atomic<bool> m_markedAsFailed { false }; //!< marker if reading failed
std::atomic_bool m_markedAsFailed { false }; //!< marker if reading failed
bool m_unitTest { false }; //!< mark as unit test
BlackMisc::Network::CUrlLogList m_urlReadLog; //!< URL based reading can be logged
};

View File

@@ -41,7 +41,7 @@ namespace BlackCore
{
//! Read vatsim data file
//! \sa http://info.vroute.net/vatsim-data.txt
class BLACKCORE_EXPORT CVatsimDataFileReader : public BlackCore::CThreadedReader
class BLACKCORE_EXPORT CVatsimDataFileReader : public CThreadedReader
{
Q_OBJECT