From 27e890cc4094622fff5f49adcea89ca32b73822c Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Fri, 30 Jul 2010 10:15:07 -0500 Subject: [PATCH] stk: Handle errors when sending to the agent fails --- src/stk.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/stk.c b/src/stk.c index 020c9ec6..957f50af 100644 --- a/src/stk.c +++ b/src/stk.c @@ -1014,9 +1014,14 @@ static gboolean handle_command_select_item(const struct stk_command *cmd, stk->cancel_cmd = stk_request_cancel; - stk_agent_request_selection(stk->current_agent, stk->select_item_menu, + /* We most likely got an out of memory error, tell SIM to retry */ + if (stk_agent_request_selection(stk->current_agent, + stk->select_item_menu, request_menu_cb, stk, - stk->timeout * 1000); + stk->timeout * 1000) < 0) { + rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY; + return TRUE; + } return FALSE; } @@ -1091,8 +1096,12 @@ static gboolean handle_command_display_text(const struct stk_command *cmd, stk->cancel_cmd = stk_request_cancel; stk->session_ended = FALSE; - stk_agent_display_text(stk->current_agent, dt->text, 0, priority, - request_text_cb, stk, timeout); + /* We most likely got an out of memory error, tell SIM to retry */ + if (stk_agent_display_text(stk->current_agent, dt->text, 0, priority, + request_text_cb, stk, timeout) < 0) { + rsp->result.type = STK_RESULT_TYPE_TERMINAL_BUSY; + return TRUE; + } return cmd->display_text.immediate_response; }