diff options
author | Roger Planas <roger.planas@isode.com> | 2016-02-05 12:45:39 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2016-02-10 14:33:37 (GMT) |
commit | af6493bf45fcd9174b485f8ae0532e2eb4e6914e (patch) | |
tree | cfabe60bd9db93ce05557ee26ba18cc4622e0db0 /Sluift/client.cpp | |
parent | dcfe31ce3055f3af7e3b617752d9c9fd16672569 (diff) | |
download | swift-af6493bf45fcd9174b485f8ae0532e2eb4e6914e.zip swift-af6493bf45fcd9174b485f8ae0532e2eb4e6914e.tar.bz2 |
Sluift: Add timeout to roster receiving operations
This avoids Sluift indefinitely waiting if the server does not
respond
Test-Information:
Before the patch, a sluift client would wait indefinitely if
a buggy XMPP server does not respond.
With this patch, sluift clients now timeout and through an
exception after SLUIFT_TIMEOUT when the server does not respond.
Change-Id: I9d36f53a8f4d5b3d594cef68c42de38fd5a1c296
Diffstat (limited to 'Sluift/client.cpp')
-rw-r--r-- | Sluift/client.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Sluift/client.cpp b/Sluift/client.cpp index 8f6ff3a..6373a20 100644 --- a/Sluift/client.cpp +++ b/Sluift/client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -186,7 +186,7 @@ SLUIFT_LUA_FUNCTION_WITH_HELP( SluiftClient* client = getClient(L); Lua::Table contactsTable; - foreach(const XMPPRosterItem& item, client->getRoster()) { + foreach(const XMPPRosterItem& item, client->getRoster(getGlobalTimeout(L))) { std::string subscription; switch(item.getSubscription()) { case RosterItemPayload::None: subscription = "none"; break; @@ -636,7 +636,7 @@ SLUIFT_LUA_FUNCTION_WITH_HELP( item.setJID(Lua::checkString(L, 2)); } - client->getRoster(); + client->getRoster(timeout); if (!client->getClient()->getRoster()->containsJID(item.getJID())) { RosterPayload::ref roster = boost::make_shared<RosterPayload>(); roster->addItem(item); |