@@ -1929,11 +1929,9 @@ static void BrokerPendingWill_FreeAll(MqttBroker* broker)
19291929#endif
19301930}
19311931
1932- #ifdef WOLFMQTT_BROKER_WILL
19331932static 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 */
19391937static 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