mirror of git://git.sysmocom.de/ofono
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:
parent
aec5b8a44f
commit
e8d18946b9
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue