Hello Nordic forum,
I must not quite understand how CoAP callbacks should work. Would anyone be able to give me any advice as to why my modified coap_client results in undefined behavior? In my main program, I'd call the function coap_send() at various points while varying the tx_payload string.
The first time coap_send() is called, everything works fine. Message gets sent and callback is received. The second time, however, the message gets sent (verified by looking at my endpoint), but I never get the LOG_INF notifying me of the server response.
When I build my program using the default optimizations, the program crashes without warning directly after sending the second message. Interestingly, when I build my program using the debugging optimization, the program will actually work and send messages correctly, but I will not receive a server response.
To me, this seems to indicate a problem with how I'm doing the response callback.