Fix: One more fix for disconnect detection

In situations where lots of data is generated by the remote side (e.g.
phonebook is being read) we can get our ring buffer filled up.  In this
case setting rbytes to zero first and then breaking out of the loop
leads to an erroneous disconnect detection.  The fix is to move setting
of rbytes after we know we still have some space.
This commit is contained in:
Denis Kenzior 2010-01-15 10:24:01 -06:00
parent aec5b8a44f
commit e8d18946b9
1 changed files with 1 additions and 2 deletions

View File

@ -776,13 +776,12 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond,
/* Regardless of condition, try to read all the data available */
do {
rbytes = 0;
toread = ring_buffer_avail_no_wrap(chat->buf);
if (toread == 0)
break;
rbytes = 0;
buf = ring_buffer_write_ptr(chat->buf);
err = g_io_channel_read(channel, (char *) buf, toread, &rbytes);