Skip to content

Commit 78c4ac2

Browse files
committed
Error corrections
1 parent 62e19ff commit 78c4ac2

File tree

8 files changed

+19
-16
lines changed

8 files changed

+19
-16
lines changed

examples/device-media-server-task/device-media-server-task.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include "WiFi.h"
99
#include "dlna.h"
10-
#include "DLNA/HttpServerUsingTask.h"
10+
#include "dlna/HttpServerUsingTask.h"
1111

1212
// Replace with your WiFi credentials
1313
const char* ssid = "YOUR_SSID";

examples/device-media-server-tasks/device-media-server-tasks.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include "WiFi.h"
99
#include "dlna.h"
10-
#include "DLNA/HttpServerUsingTasks.h"
10+
#include "dlna/HttpServerUsingTasks.h"
1111

1212
// Replace with your WiFi credentials
1313
const char* ssid = "YOUR_SSID";

src/dlna/clients/SubscriptionMgrControlPoint.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class SubscriptionMgrControlPoint {
223223
uint64_t subscribe_timeout = 0;
224224
uint32_t event_subscription_duration_sec = 3600;
225225
uint32_t event_subscription_retry_ms = 0;
226-
bool event_subscription_active = false;
226+
bool event_subscription_active = true;
227227
uint64_t last_event_notify_ms = 0; // timestamp of last received NOTIFY
228228
IHttpRequest* p_http = nullptr;
229229
IUDPService* p_udp = nullptr;
@@ -368,6 +368,7 @@ class SubscriptionMgrControlPoint {
368368
* failures result in continued attempts for remaining services).
369369
*/
370370
bool subscribeToDevice(DLNADeviceInfo& device) {
371+
DlnaLogger.log(DlnaLogLevel::Info, "subscribeToDevice");
371372
bool ok = true;
372373
for (auto& service : device.getServices()) {
373374
if (!subscribeToService(service)) {
@@ -390,6 +391,7 @@ class SubscriptionMgrControlPoint {
390391
* @return true if all unsubscriptions succeeded; false otherwise.
391392
*/
392393
bool unsubscribeFromDevice(DLNADeviceInfo& device) {
394+
DlnaLogger.log(DlnaLogLevel::Info, "unsubscribeFromDevice");
393395
bool ok = true;
394396
for (auto& service : device.getServices()) {
395397
if (!unsubscribeFromService(service)) {
@@ -539,10 +541,6 @@ class SubscriptionMgrControlPoint {
539541
// read SID header and body
540542
const char* sid = client.requestHeader().get("SID");
541543

542-
// Use XMLParserPrint to incrementally parse the NOTIFY body and extract
543-
// property child elements. XMLParserPrint accumulates the buffer and
544-
// exposes a parse() method that returns the next fragment.
545-
546544
// mark notify received early so subscription metadata gets updated
547545
mgr->updateReceived(sid);
548546

src/dlna/devices/DLNADevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ class DLNADevice : public IDevice {
438438
is_subscribe = true;
439439
return handleSubscribe(client, server, requestPath, hl); // If needed
440440
}
441-
if (req.method() == T_UNSUBSCRIBE) {
441+
if (req.method() == T_UNSUBSCRIBE || req.method() == T_POST) {
442442
return handleUnsubscribe(client, server, requestPath, hl); // If
443443
}
444444
}

src/dlna_config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,6 @@
186186
#ifndef DLNA_DISCOVERY_NETMASK
187187
#define DLNA_DISCOVERY_NETMASK IPAddress(255, 255, 255, 0)
188188
#endif
189+
190+
// Deactivate warnings
191+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

src/http/Server/HttpClientHandler.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ class HttpClientHandler : public IClientHandler {
125125
#if DLNA_LOG_XML
126126
callback(Serial, ref);
127127
#endif
128-
#if DLNA_CHECK_XML_LENGTH
128+
129+
#if DLNA_CHECK_XML_LENGTH
129130
StrPrint test;
130131
size_t test_len = callback(test, ref);
131132
if (strlen(test.c_str()) != size) {
@@ -177,9 +178,6 @@ class HttpClientHandler : public IClientHandler {
177178
reply("text/plain", msg, err, msg);
178179
}
179180

180-
181-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
182-
183181
void endClient() override {
184182
if (p_client) {
185183
p_client->flush();

src/http/Server/HttpRequest.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,12 @@ class HttpRequest : public IHttpRequest {
330330
StrPrint test;
331331
size_t test_len = writer(test, ref);
332332
if (strlen(test.c_str()) != len) {
333-
DlnaLogger.log(DlnaLogLevel::Error,
334-
"HttpRequest test wrote %d bytes: expected %d / strlen: %d", test_len, len, strlen(test.c_str()));
335-
}
336-
#endif
333+
DlnaLogger.log(
334+
DlnaLogLevel::Error,
335+
"HttpRequest test wrote %d bytes: expected %d / strlen: %d",
336+
test_len, len, strlen(test.c_str()));
337+
}
338+
#endif
337339
}
338340

339341
// read reply header and prepare chunk reader if needed

src/http/Server/HttpServer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ class HttpServer : public IHttpServer {
243243
if (client.connected()) {
244244
DlnaLogger.log(DlnaLogLevel::Info, "copy: accepted new client");
245245
client.setTimeout(DLNA_HTTP_REQUEST_TIMEOUT_MS);
246+
#ifdef ESP32
246247
client.setNoDelay(true); // disables Nagle
248+
#endif
247249
open_clients.push_back(client);
248250
}
249251

0 commit comments

Comments
 (0)