mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-20 14:53:53 +00:00
Stop issuing further HTTP requests when quitting
This commit is contained in:
parent
d00bdff495
commit
2a0f837120
1 changed files with 16 additions and 1 deletions
|
@ -623,12 +623,15 @@ public:
|
||||||
: m_ComputerManager(computerManager),
|
: m_ComputerManager(computerManager),
|
||||||
m_Address(address),
|
m_Address(address),
|
||||||
m_MdnsIpv6Address(mdnsIpv6Address),
|
m_MdnsIpv6Address(mdnsIpv6Address),
|
||||||
m_Mdns(mdns)
|
m_Mdns(mdns),
|
||||||
|
m_AboutToQuit(false)
|
||||||
{
|
{
|
||||||
connect(this, &PendingAddTask::computerAddCompleted,
|
connect(this, &PendingAddTask::computerAddCompleted,
|
||||||
computerManager, &ComputerManager::computerAddCompleted);
|
computerManager, &ComputerManager::computerAddCompleted);
|
||||||
connect(this, &PendingAddTask::computerStateChanged,
|
connect(this, &PendingAddTask::computerStateChanged,
|
||||||
computerManager, &ComputerManager::handleComputerStateChanged);
|
computerManager, &ComputerManager::handleComputerStateChanged);
|
||||||
|
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit,
|
||||||
|
this, &PendingAddTask::handleAboutToQuit);
|
||||||
}
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -637,9 +640,20 @@ signals:
|
||||||
void computerStateChanged(NvComputer* computer);
|
void computerStateChanged(NvComputer* computer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleAboutToQuit()
|
||||||
|
{
|
||||||
|
m_AboutToQuit = true;
|
||||||
|
}
|
||||||
|
|
||||||
QString fetchServerInfo(NvHTTP& http)
|
QString fetchServerInfo(NvHTTP& http)
|
||||||
{
|
{
|
||||||
QString serverInfo;
|
QString serverInfo;
|
||||||
|
|
||||||
|
// Do nothing if we're quitting
|
||||||
|
if (m_AboutToQuit) {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// There's a race condition between GameStream servers reporting presence over
|
// There's a race condition between GameStream servers reporting presence over
|
||||||
// mDNS and the HTTPS server being ready to respond to our queries. To work
|
// mDNS and the HTTPS server being ready to respond to our queries. To work
|
||||||
|
@ -823,6 +837,7 @@ private:
|
||||||
NvAddress m_Address;
|
NvAddress m_Address;
|
||||||
NvAddress m_MdnsIpv6Address;
|
NvAddress m_MdnsIpv6Address;
|
||||||
bool m_Mdns;
|
bool m_Mdns;
|
||||||
|
bool m_AboutToQuit;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ComputerManager::addNewHost(NvAddress address, bool mdns, NvAddress mdnsIpv6Address)
|
void ComputerManager::addNewHost(NvAddress address, bool mdns, NvAddress mdnsIpv6Address)
|
||||||
|
|
Loading…
Reference in a new issue