mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
committed by
Mathew Sutcliffe
parent
660798e43c
commit
f2602a8915
@@ -42,6 +42,7 @@
|
||||
#include <QEventLoop>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QHttpMultiPart>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QProcess>
|
||||
|
||||
@@ -98,16 +98,15 @@ namespace BlackCore
|
||||
{
|
||||
static const CLogCategoryList cats(CLogCategoryList(this).join({ CLogCategory::swiftDbWebservice()}));
|
||||
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> nwReply(nwReplyPtr);
|
||||
m_pendingReply = nullptr;
|
||||
QUrl url(nwReply->url());
|
||||
QString urlString(url.toString());
|
||||
|
||||
if (m_shutdown)
|
||||
{
|
||||
nwReply->abort();
|
||||
return;
|
||||
}
|
||||
|
||||
m_pendingReply = nullptr;
|
||||
const QUrl url(nwReply->url());
|
||||
const QString urlString(url.toString());
|
||||
if (nwReply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
const QString dataFileData(nwReply->readAll().trimmed());
|
||||
@@ -128,7 +127,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
QString error = nwReply->errorString();
|
||||
const QString error = nwReply->errorString();
|
||||
nwReply->close(); // close asap
|
||||
const CStatusMessageList msgs( {CStatusMessage(cats, CStatusMessage::SeverityError, "HTTP error: " + error)});
|
||||
emit publishedModels(CAircraftModelList(), CAircraftModelList(), msgs, false, false);
|
||||
@@ -147,7 +146,7 @@ namespace BlackCore
|
||||
bool CDatabaseWriter::isReplyOverdue() const
|
||||
{
|
||||
if (m_replyPendingSince < 0 || !m_pendingReply) { return false; }
|
||||
qint64 ms = QDateTime::currentMSecsSinceEpoch() - m_replyPendingSince;
|
||||
const qint64 ms = QDateTime::currentMSecsSinceEpoch() - m_replyPendingSince;
|
||||
return ms > 7500;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BlackCore
|
||||
//! Constructor
|
||||
CDatabaseWriter(const BlackMisc::Network::CUrl &baseUrl, QObject *parent);
|
||||
|
||||
//! Write models to DB
|
||||
//! Write model to DB
|
||||
BlackMisc::CStatusMessageList asyncPublishModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
//! Write models to DB
|
||||
@@ -45,6 +45,9 @@ namespace BlackCore
|
||||
//! Shutdown
|
||||
void gracefulShutdown();
|
||||
|
||||
//! Shutting down?
|
||||
bool isShuttingDown() const { return m_shutdown; }
|
||||
|
||||
signals:
|
||||
//! Published models, the response to \sa asyncPublishModels
|
||||
void publishedModels(const BlackMisc::Simulation::CAircraftModelList &modelsPublished,
|
||||
|
||||
Reference in New Issue
Block a user