Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: send_ack_packet no longer causes unexpected behaviour if shared data lib fails to send #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions libraries/provisioning/provisioning.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,25 @@ static uint32_t send_ack_packet(void)
res = Shared_Data_sendData(&data_to_send, packet_sent_cb);
if (res != APP_LIB_DATA_SEND_RES_SUCCESS)
{
LOG(LVL_WARNING, "State WAIT_DATA : Error sending ACK (res:%d).", res);
return APP_SCHEDULER_SCHEDULE_ASAP;
LOG(LVL_WARNING, "State WAIT_DATA : Error sending ACK (res:%u).", res);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think setting "m_events.timeout = 1;" here instead would be cleaner.
It should have exactly same behavior.

// Timeout immediately as the packet failed to send
m_timeout_ms = APP_SCHEDULER_SCHEDULE_ASAP;
}
else
{
/* Set a timeout in case the packets takes to much time
* to be sent.
*/
* to be sent.
*/
m_timeout_ms = m_conf.timeout_s * 1000;
if (App_Scheduler_addTask_execTime(timeout_task,
}

if (App_Scheduler_addTask_execTime(timeout_task,
m_timeout_ms,
500) != APP_SCHEDULER_RES_OK)
{
reset_provisioning();
m_conf.end_cb(PROV_RES_ERROR_INTERNAL);
LOG(LVL_ERROR, "State WAIT_DATA : Error adding task.");
}
{
reset_provisioning();
m_conf.end_cb(PROV_RES_ERROR_INTERNAL);
LOG(LVL_ERROR, "State WAIT_DATA : Error adding task.");
}

return APP_SCHEDULER_STOP_TASK;
Expand Down