Bug 739121: Nonblocking IO handling error in RIL.cpp, r=qdot

This commit is contained in:
Cervantes Yu 2012-04-06 19:58:31 -07:00
Родитель ac2fa7e286
Коммит cfaab10c4a
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -278,6 +278,15 @@ RilClient::OnFileCanReadWithoutBlocking(int fd)
mIncoming = new RilRawData();
ssize_t ret = read(fd, mIncoming->mData, RilRawData::MAX_DATA_SIZE);
if (ret <= 0) {
if (ret == -1) {
if (errno == EINTR) {
continue; // retry system call when interrupted
}
else if (errno == EAGAIN || errno == EWOULDBLOCK) {
return; // no data available: return and re-poll
}
// else fall through to error handling on other errno's
}
LOG("Cannot read from network, error %d\n", ret);
// At this point, assume that we can't actually access
// the socket anymore, and start a reconnect loop.