summaryrefslogtreecommitdiffstats
path: root/gatchat
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2011-07-11 15:51:34 -0500
committerDenis Kenzior <denkenz@gmail.com>2011-07-11 15:51:34 -0500
commit329f2d724b25cd934dc834a3cac9c7b12dbb2df9 (patch)
tree4c10e33d2735d40a90f133281225ce424ec3c4f1 /gatchat
parent1789bd5d4b77bb1bc0b8330074ee2a2060c555dc (diff)
downloadofono-329f2d724b25cd934dc834a3cac9c7b12dbb2df9.tar.bz2
gatserver: fix certain bad behavior
Due to the new GAtIO semantics, the receive function is called immediately if the receive buffer is not empty. This caused certain funny behavior in non-command (e.g. empty, a/) processing.
Diffstat (limited to 'gatchat')
-rw-r--r--gatchat/gatserver.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index 3a996cb5..ab785f7e 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -1055,13 +1055,13 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data)
case PARSER_RESULT_REPEAT_LAST:
p->cur_pos = 0;
+ ring_buffer_drain(rbuf, p->read_so_far);
if (p->last_line)
server_parse_line(p);
else
g_at_server_send_final(p,
G_AT_SERVER_RESULT_OK);
- ring_buffer_drain(rbuf, p->read_so_far);
break;
default:
@@ -1179,6 +1179,9 @@ static void server_wakeup_writer(GAtServer *server)
static void server_resume(GAtServer *server)
{
+ if (server->suspended == FALSE)
+ return;
+
server->suspended = FALSE;
g_at_io_set_read_handler(server->io, new_bytes, server);
}