Skip to content

Commit e28a5b0

Browse files
committed
Updates after rebase
1 parent 96637ba commit e28a5b0

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

scripts/broker.test

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ else
864864
echo "FAIL: Clean session persistence (got_msg=$T21_GOT_MSG)"
865865
FAIL=1
866866
fi
867+
fi
867868

868869
# --- WebSocket Tests ---
869870
ws_client_bin="examples/websocket/websocket_client"
@@ -872,9 +873,9 @@ echo "$broker_features" | grep -q "websocket" && has_websocket=yes
872873

873874
if [ "$has_websocket" = "yes" ] && [ -x ./$ws_client_bin ]; then
874875

875-
# --- Test 17: WebSocket connect and subscribe ---
876+
# --- Test 22: WebSocket connect and subscribe ---
876877
echo ""
877-
echo "--- Test 17: WebSocket connect and subscribe ---"
878+
echo "--- Test 22: WebSocket connect and subscribe ---"
878879
generate_port
879880
ws_port=$port
880881
generate_port

src/mqtt_broker.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,11 +1929,9 @@ static void BrokerPendingWill_FreeAll(MqttBroker* broker)
19291929
#endif
19301930
}
19311931

1932-
#ifdef WOLFMQTT_BROKER_WILL
19331932
static void BrokerClient_PublishWillImmediate(MqttBroker* broker,
19341933
const char* topic, const byte* payload, word16 payload_len,
19351934
MqttQoS qos, byte retain);
1936-
#endif
19371935

19381936
/* Process pending wills - publish any that have expired their delay */
19391937
static int BrokerPendingWill_Process(MqttBroker* broker)
@@ -3039,7 +3037,7 @@ static int BrokerClient_Process(MqttBroker* broker, BrokerClient* bc)
30393037
return 0;
30403038
}
30413039
}
3042-
#endif
3040+
#endif /* ENABLE_MQTT_TLS */
30433041

30443042
/* Try non-blocking read (timeout=0) */
30453043
rc = MqttPacket_Read(&bc->client, bc->rx_buf, BROKER_CLIENT_RX_SZ(bc), 0);
@@ -3255,10 +3253,16 @@ int MqttBroker_Step(MqttBroker* broker)
32553253
activity = 1;
32563254
}
32573255
}
3256+
}
3257+
#endif /* ENABLE_MQTT_TLS */
32583258

32593259
#ifdef ENABLE_MQTT_WEBSOCKET
3260-
/* 1b. Service WebSocket connections (non-blocking) */
3260+
/* 1b. Service WebSocket connections (non-blocking).
3261+
* lws_service() uses poll/epoll internally and may block even with
3262+
* timeout=0 when connections are active. Cancel the service first
3263+
* to force the internal poll to return immediately. */
32613264
if (broker->ws_ctx != NULL) {
3265+
lws_cancel_service(broker->ws_ctx);
32623266
lws_service(broker->ws_ctx, 0);
32633267
}
32643268
#endif

0 commit comments

Comments
 (0)