summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Mons <edwin.mons@isode.com>2015-04-29 09:21:29 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-04-30 09:12:53 (GMT)
commitda1d43a2c7ae0468f1d38f40c33a0d11ce4c2daf (patch)
treec18f7b14131871ebcd4461e8dacaafc3dbf431d9 /Sluift/client.cpp
parent1e5ca0c1fe156cd614cfbfce432c40eeadb893fd (diff)
downloadswift-da1d43a2c7ae0468f1d38f40c33a0d11ce4c2daf.zip
swift-da1d43a2c7ae0468f1d38f40c33a0d11ce4c2daf.tar.bz2
Honour global sluift timeout setting in add/remove contact
The add_contact and remove_contact calls used a fixed timeout of -1, which could cause the operation to hang forever, even when a timeout was set. Test-Information: add_contact and remove_contact properly honour global timeout on a broken connection. Change-Id: I6bd877a8123ddab87b1f653c0cfda7a6b101dae7
Diffstat (limited to 'Sluift/client.cpp')
-rw-r--r--Sluift/client.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Sluift/client.cpp b/Sluift/client.cpp
index 79d988a..f1fc2c7 100644
--- a/Sluift/client.cpp
+++ b/Sluift/client.cpp
@@ -601,6 +601,8 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
Sluift::globals.eventLoop.runOnce();
SluiftClient* client = getClient(L);
RosterItemPayload item;
+ int timeout = getGlobalTimeout(L);
+
if (lua_type(L, 2) == LUA_TTABLE) {
lua_getfield(L, 2, "jid");
const char* rawJID = lua_tostring(L, -1);
@@ -639,7 +641,7 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
roster->addItem(item);
Sluift::Response response = client->sendVoidRequest(
- SetRosterRequest::create(roster, client->getClient()->getIQRouter()), -1);
+ SetRosterRequest::create(roster, client->getClient()->getIQRouter()), timeout);
if (response.error) {
return response.convertToLuaResult(L);
}
@@ -659,12 +661,13 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
Sluift::globals.eventLoop.runOnce();
SluiftClient* client = getClient(L);
JID jid(Lua::checkString(L, 2));
+ int timeout = getGlobalTimeout(L);
RosterPayload::ref roster = boost::make_shared<RosterPayload>();
roster->addItem(RosterItemPayload(JID(Lua::checkString(L, 2)), "", RosterItemPayload::Remove));
return client->sendVoidRequest(
- SetRosterRequest::create(roster, client->getClient()->getIQRouter()), -1).convertToLuaResult(L);
+ SetRosterRequest::create(roster, client->getClient()->getIQRouter()), timeout).convertToLuaResult(L);
}
SLUIFT_LUA_FUNCTION_WITH_HELP(