mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 03:52:06 +01:00
Don't wait the reply timeout in OfflineMessageManager.getMessages(List<String>)
for the last message. We now count the number of messages we want to retrieve, and don't wait for another message if we have already received all. Thanks to King Jeong Hun for reporting this.
This commit is contained in:
parent
f31cc6e043
commit
b5415fe841
1 changed files with 3 additions and 1 deletions
|
@ -158,12 +158,14 @@ public class OfflineMessageManager {
|
||||||
return nodes.contains(info.getNode());
|
return nodes.contains(info.getNode());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
int pendingNodes = nodes.size();
|
||||||
StanzaCollector messageCollector = connection.createStanzaCollector(messageFilter);
|
StanzaCollector messageCollector = connection.createStanzaCollector(messageFilter);
|
||||||
try {
|
try {
|
||||||
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
|
||||||
// Collect the received offline messages
|
// Collect the received offline messages
|
||||||
Message message = messageCollector.nextResult();
|
Message message = messageCollector.nextResult();
|
||||||
while (message != null) {
|
while (message != null && pendingNodes > 0) {
|
||||||
|
pendingNodes--;
|
||||||
messages.add(message);
|
messages.add(message);
|
||||||
message = messageCollector.nextResult();
|
message = messageCollector.nextResult();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue