diff options
Diffstat (limited to 'gatchat/gatserver.c')
-rw-r--r-- | gatchat/gatserver.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c index 5b5e2f74..05392e9a 100644 --- a/gatchat/gatserver.c +++ b/gatchat/gatserver.c @@ -136,7 +136,12 @@ static void send_common(GAtServer *server, const char *buf, unsigned int len) buf + bytes_written, wbytes); - if (ring_buffer_avail(write_buf) == 0) + /* + * Make sure we don't allocate a buffer if we've written + * everything out already + */ + if (ring_buffer_avail(write_buf) == 0 && + bytes_written < towrite) write_buf = allocate_next(server); } |