Skip to content

Commit 75cf523

Browse files
committed
Peer review fixes
1 parent 6ee7bfe commit 75cf523

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

examples/mqttnet.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ static int NetConnect(void *context, const char* host, word16 port,
12151215
if (rc == 0) {
12161216
return MQTT_CODE_SUCCESS;
12171217
}
1218-
if (rc == -WOLFIP_EAGAIN || rc == -11) {
1218+
if (rc == -WOLFIP_EAGAIN) {
12191219
return MQTT_CODE_CONTINUE;
12201220
}
12211221

@@ -1243,6 +1243,7 @@ static int NetRead(void *context, byte* buf, int buf_len, int timeout_ms)
12431243
}
12441244

12451245
rc = wolfIP_sock_recv(sock->stack, sock->fd, buf, buf_len, 0);
1246+
/* -WOLFIP_EAGAIN: no data yet; -1: socket not yet in ESTABLISHED state */
12461247
if (rc == -WOLFIP_EAGAIN || rc == -1) {
12471248
return MQTT_CODE_CONTINUE;
12481249
}
@@ -1265,6 +1266,7 @@ static int NetWrite(void *context, const byte* buf, int buf_len,
12651266
}
12661267

12671268
rc = wolfIP_sock_send(sock->stack, sock->fd, buf, buf_len, 0);
1269+
/* -WOLFIP_EAGAIN: send buffer full; -1: socket not yet in ESTABLISHED state */
12681270
if (rc == -WOLFIP_EAGAIN || rc == -1) {
12691271
return MQTT_CODE_CONTINUE;
12701272
}

src/mqtt_broker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
/* -------------------------------------------------------------------------- */
7070
#ifndef BROKER_SLEEP_MS
7171
#if defined(WOLFMQTT_WOLFIP)
72-
#define BROKER_SLEEP_MS(ms) /* no-op: Step() returns to caller */
72+
#define BROKER_SLEEP_MS(ms) /* no-op: cooperative scheduling - Step() returns to caller for task switching */
7373
#elif defined(USE_WINDOWS_API)
7474
#define BROKER_SLEEP_MS(ms) Sleep(ms)
7575
#else

0 commit comments

Comments
 (0)