I noticed my MQTT clients' wills were getting published but not MQTT-SN clients. Upon some investigation into the code I found MQTTProtocol_keepalive in MQTTProtocolClient.c which is responsible for closing timed out client sessions with the send_will flag set. It iterates through bstate->clients and checks whether client->protocol == PROTOCOL_MQTTS. However that is always going to be false because the MQTT-SN clients are not in bstate->clients, they are in bstate->mqtts_clients.
I noticed my MQTT clients' wills were getting published but not MQTT-SN clients. Upon some investigation into the code I found
MQTTProtocol_keepalive
in MQTTProtocolClient.c which is responsible for closing timed out client sessions with thesend_will
flag set. It iterates throughbstate->clients
and checks whetherclient->protocol == PROTOCOL_MQTTS
. However that is always going to be false because the MQTT-SN clients are not inbstate->clients
, they are inbstate->mqtts_clients
.