Skip to content

Commit

Permalink
samples: cellular: multi_service: Handle connection failure immediately
Browse files Browse the repository at this point in the history
If NRF_CLOUD_EVT_TRANSPORT_CONNECT_ERROR is raised by nrf_cloud,
reset connection and retry immediately rather than wait for the
readiness timeout.

Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
  • Loading branch information
glarsennordic committed Aug 14, 2023
1 parent 58f3368 commit ce7e476
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ static void cloud_event_handler(const struct nrf_cloud_evt *nrf_cloud_evt)
break;
case NRF_CLOUD_EVT_TRANSPORT_CONNECT_ERROR:
LOG_DBG("NRF_CLOUD_EVT_TRANSPORT_CONNECT_ERROR: %d", nrf_cloud_evt->status);

/* Disconnect from cloud immediately rather than wait for retry timeout. */
disconnect_cloud();

break;
case NRF_CLOUD_EVT_USER_ASSOCIATION_REQUEST:
LOG_DBG("NRF_CLOUD_EVT_USER_ASSOCIATION_REQUEST");
Expand Down

0 comments on commit ce7e476

Please sign in to comment.