Cleanup variable naming modern advertiser

This commit is contained in:
Salanto 2021-09-10 23:40:27 +02:00
parent 8865625cd7
commit 4ac4dfdcc7
2 changed files with 15 additions and 15 deletions

View File

@ -69,7 +69,7 @@ public slots:
* @brief Reads the information send as a reply for further error handling. * @brief Reads the information send as a reply for further error handling.
* @param reply Response data from the masterserver. Information contained is send to the console if debug is enabled. * @param reply Response data from the masterserver. Information contained is send to the console if debug is enabled.
*/ */
void msRequestFinished(QNetworkReply *reply); void msRequestFinished(QNetworkReply *f_reply);
/** /**
* @brief Sets the values being advertised to masterserver. * @brief Sets the values being advertised to masterserver.

View File

@ -20,20 +20,20 @@ void HTTPAdvertiser::msAdvertiseServer()
QNetworkRequest request(url); QNetworkRequest request(url);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QJsonObject json; QJsonObject l_json;
json["port"] = m_port; l_json["port"] = m_port;
if (m_ws_port != -1) { if (m_ws_port != -1) {
json["ws_port"] = m_ws_port; l_json["ws_port"] = m_ws_port;
} }
json["players"] = m_players; l_json["players"] = m_players;
json["name"] = m_name; l_json["name"] = m_name;
if (!m_description.isEmpty()) { if (!m_description.isEmpty()) {
json["description"] = m_description; l_json["description"] = m_description;
} }
m_manager->post(request, QJsonDocument(json).toJson()); m_manager->post(request, QJsonDocument(l_json).toJson());
if (m_debug) if (m_debug)
qDebug().noquote() << "Advertised Server"; qDebug().noquote() << "Advertised Server";
@ -45,25 +45,25 @@ void HTTPAdvertiser::msAdvertiseServer()
} }
void HTTPAdvertiser::msRequestFinished(QNetworkReply *reply) void HTTPAdvertiser::msRequestFinished(QNetworkReply *f_reply)
{ {
if (m_debug) { if (m_debug) {
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200) { if (f_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200) {
qDebug().noquote() << "Succesfully advertised server."; qDebug().noquote() << "Succesfully advertised server.";
} }
else { else {
QJsonDocument json = QJsonDocument::fromJson(reply->readAll()); QJsonDocument json = QJsonDocument::fromJson(f_reply->readAll());
if (json.isNull()) { if (json.isNull()) {
qCritical().noquote() << "Invalid JSON response from" << reply->url(); qCritical().noquote() << "Invalid JSON response from" << f_reply->url();
reply->deleteLater(); f_reply->deleteLater();
return; return;
} }
qDebug().noquote() << "Got valid response from" << reply->url(); qDebug().noquote() << "Got valid response from" << f_reply->url();
qDebug() << json; qDebug() << json;
} }
} }
reply->deleteLater(); f_reply->deleteLater();
} }
void HTTPAdvertiser::setAdvertiserSettings(advertiser_config config) void HTTPAdvertiser::setAdvertiserSettings(advertiser_config config)