I'm using v1.2.0 for the nrf project and I am fairly confident I am using modem firmware 1.1.1 (though I don't know how to verify that).
I'm basing my project on "cloud_client" example using the aws_iot backend, and have this function setup:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static void aws_iot_test_work(struct k_work *work) {
LOG_DBG("AWS IoT Work!");
int err = cloud_connect(s_cloud_backend);
if (err) {
LOG_DBG("connect error: %d", err);
return;
}
LOG_DBG("Connect success!");
struct pollfd fds[] = {
{
.fd = s_cloud_backend->config->socket,
.events = POLLIN
}
};
while(1) {
err = poll(fds, ARRAY_SIZE(fds), K_MSEC(10000));
if (err < 0) {
LOG_DBG("poll error!: %d", err);
goto out_disconnect;
}
if (err == 0) {
Running this function once works. It connects, waits 10 seconds, and then disconnects just fine.
When I run it a second time though it hangs the process. I've traced the problem to this line in "zephyr/subsys/net/lib/mqtt/mqtt_transport_socket_tls.c":
Fullscreen
1
2
ret = connect(client->transport.tls.sock, client->broker,
peer_addr_size);
After this I believe its just making calls into bsdlib which we don't have source for.
Any thoughts on what else I need to do with the mqtt_client or socket so I can reuse it?