Fix: Sometimes it is possible to cancel first cmd

Commands on the head of the queue can be canceled if none of its bytes
have actually been written to the modem.  This is tracked by
cmd_bytes_written variable.
This commit is contained in:
Denis Kenzior 2009-12-02 15:27:26 -06:00
parent 0d022d3057
commit 9b5b1057e4
1 changed files with 2 additions and 1 deletions

View File

@ -1202,7 +1202,8 @@ gboolean g_at_chat_cancel(GAtChat *chat, guint id)
if (!l)
return FALSE;
if (l == g_queue_peek_head(chat->command_queue)) {
if (l == g_queue_peek_head(chat->command_queue) &&
chat->cmd_bytes_written > 0) {
struct at_command *c = l->data;
/* We can't actually remove it since it is most likely