summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-12-02 15:27:26 -0600
committerMarcel Holtmann <marcel@holtmann.org>2009-12-03 02:16:21 +0100
commit962a4cd52d14eed73aa4897de16c928e3a5e1493 (patch)
tree66833427aadd86bed08e966cff43dcc2dc6bccf6
parentbe04d3a32cb5c8d9e2d5bb4b640b720d784600dc (diff)
downloadconnman-962a4cd52d14eed73aa4897de16c928e3a5e1493.tar.gz
connman-962a4cd52d14eed73aa4897de16c928e3a5e1493.tar.bz2
connman-962a4cd52d14eed73aa4897de16c928e3a5e1493.zip
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.
-rw-r--r--gatchat/gatchat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index 1dffd89a..df659066 100644
--- a/gatchat/gatchat.c
+++ b/gatchat/gatchat.c
@@ -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