Skip to content

Commit

Permalink
Improve reopen errors handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Dec 19, 2024
1 parent 3cc7199 commit 6bb2429
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/net/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,19 @@ z_result_t _z_reopen(_z_session_rc_t *zn) {
z_sleep_s(1);
continue;
} else {
_Z_ERROR("Reopen failed: %i", ret);
return ret;
}
}

#if Z_FEATURE_MULTI_THREAD == 1
_zp_start_lease_task(zs, zs->_lease_task_attr);
_zp_start_read_task(zs, zs->_read_task_attr);
ret = _zp_start_lease_task(zs, zs->_lease_task_attr);
if (ret != _Z_RES_OK) {
return ret;
}
ret = _zp_start_read_task(zs, zs->_read_task_attr);
if (ret != _Z_RES_OK) {
return ret;
}
#endif // Z_FEATURE_MULTI_THREAD == 1

if (ret == _Z_RES_OK && !_z_network_message_list_is_empty(zs->_decalaration_cache)) {
Expand Down
1 change: 0 additions & 1 deletion src/system/rpi_pico/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ z_result_t _z_task_join(_z_task_t *task) {

z_result_t _z_task_detach(_z_task_t *task) {
_ZP_UNUSED(task);
assert(false);
return _Z_ERR_GENERIC;
}

Expand Down
5 changes: 4 additions & 1 deletion src/transport/unicast/lease.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ static void _zp_unicast_failed(_z_transport_unicast_t *ztu) {

#if Z_FEATURE_AUTO_RECONNECT == 1
_z_session_rc_ref_t *zs = ztu->_common._session;
_z_reopen(zs);
z_result_t ret = _z_reopen(zs);
if (ret != _Z_RES_OK) {
_Z_ERROR("Reopen failed: %i", ret);
}
#endif
}

Expand Down

0 comments on commit 6bb2429

Please sign in to comment.