Commit a3f8f376 authored by Yaroslav Kurlaev's avatar Yaroslav Kurlaev Committed by Andrius Štikonas
Browse files

Fix upnp closing connection

* call start() after HTTPRequest creation
* connect replyFinished to QNetworkReply::finished instead of QNetworkAccessManager::finished

BUG: 404135
parent 9a55b51c
......@@ -39,7 +39,6 @@ HTTPRequest::HTTPRequest(const QNetworkRequest &hdr, const QString &payload, con
, success(false)
{
networkAccessManager = new QNetworkAccessManager(this);
connect(networkAccessManager, &QNetworkAccessManager::finished, this, &HTTPRequest::replyFinished);
networkAccessManager->connectToHost(host, port);
QTcpSocket socket;
......@@ -63,10 +62,11 @@ HTTPRequest::HTTPRequest(const QNetworkRequest &hdr, const QString &payload, con
void HTTPRequest::start()
{
networkAccessManager->post(hdr, m_payload.toLatin1());
networkReply = networkAccessManager->post(hdr, m_payload.toLatin1());
connect(networkReply, &QNetworkReply::finished, this, &HTTPRequest::replyFinished);
}
void HTTPRequest::replyFinished(QNetworkReply *networkReply)
void HTTPRequest::replyFinished()
{
if (networkReply->error()) {
error = networkReply->errorString();
......@@ -76,6 +76,7 @@ void HTTPRequest::replyFinished(QNetworkReply *networkReply)
return;
}
reply = networkReply->readAll();
networkReply->deleteLater();
success = true;
Q_EMIT result(this);
operationFinished(this);
......
......@@ -85,13 +85,14 @@ Q_SIGNALS:
void result(HTTPRequest *r);
public:
void replyFinished(QNetworkReply *networkReply);
void replyFinished();
private:
void parseReply(int eoh);
private:
QNetworkRequest hdr;
QNetworkReply *networkReply;
QString m_payload;
bool verbose;
QString host;
......
......@@ -392,6 +392,7 @@ HTTPRequest *UPnPRouter::UPnPRouterPrivate::sendSoapQuery(const QString &query,
// Only listen for results when we are not exiting
active_reqs.append(r);
}
r->start();
return r;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment