fix a bug where timeouts would only be handled when a message was delivered
Change-Id: Id3127b21c1a1a1afab32911a8edbb202360d7c9b
This commit is contained in:
parent
58959343db
commit
954fdd27ca
@ -91,19 +91,23 @@ sp<MessageBase> MessageQueue::waitMessage(nsecs_t timeout)
|
||||
mMessages.remove(cur);
|
||||
break;
|
||||
}
|
||||
if (timeout>=0 && timeoutTime < now) {
|
||||
// we timed-out, return a NULL message
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
nextEventTime = result->when;
|
||||
result = 0;
|
||||
}
|
||||
|
||||
if (timeout >= 0 && nextEventTime > 0) {
|
||||
if (timeout >= 0) {
|
||||
if (timeoutTime < now) {
|
||||
// we timed-out, return a NULL message
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
if (nextEventTime > 0) {
|
||||
if (nextEventTime > timeoutTime) {
|
||||
nextEventTime = timeoutTime;
|
||||
}
|
||||
} else {
|
||||
nextEventTime = timeoutTime;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextEventTime >= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user