diff options
author | Thorvald Natvig <slicer@users.sourceforge.net> | 2010-03-18 20:18:21 +0300 |
---|---|---|
committer | Thorvald Natvig <slicer@users.sourceforge.net> | 2010-03-18 20:18:21 +0300 |
commit | 0485e2e69a32e9e08776c83c08cc544183ab61cb (patch) | |
tree | 4d11bc345939817488676b4ed89c1dda4197452e | |
parent | 77e88482d7cecae4143451be9dfdbf97385ffdca (diff) |
Add timeout to authenticators
-rwxr-xr-x | scripts/testauth.py | 5 | ||||
-rw-r--r-- | src/murmur/MurmurIce.cpp | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/scripts/testauth.py b/scripts/testauth.py index 41a5361ff..ad2e64ce4 100755 --- a/scripts/testauth.py +++ b/scripts/testauth.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -import Ice, sys +import Ice, sys, time from M2Crypto import X509; Ice.loadSlice('Murmur.ice') import Murmur @@ -25,6 +25,8 @@ class ServerAuthenticatorI(Murmur.ServerUpdatingAuthenticator): return (2, "twO", groups) else: return (-1, None, None) + elif (name == "Fail"): + time.sleep(6) return (-2, None, None) def getInfo(self, id, current=None): @@ -87,7 +89,6 @@ if __name__ == "__main__": for server in meta.getBootedServers(): serverR=Murmur.ServerUpdatingAuthenticatorPrx.uncheckedCast(adapter.addWithUUID(ServerAuthenticatorI(server, adapter))) server.setAuthenticator(serverR) -# server.registerUser("TestUser") print "Done" diff --git a/src/murmur/MurmurIce.cpp b/src/murmur/MurmurIce.cpp index 2eab1d462..3b36fc16a 100644 --- a/src/murmur/MurmurIce.cpp +++ b/src/murmur/MurmurIce.cpp @@ -751,7 +751,7 @@ static void impl_Server_setAuthenticator(const ::Murmur::AMD_Server_setAuthentic ::Murmur::ServerAuthenticatorPrx prx; try { - prx = ::Murmur::ServerAuthenticatorPrx::checkedCast(aptr->ice_connectionCached(false)); + prx = ::Murmur::ServerAuthenticatorPrx::checkedCast(aptr->ice_connectionCached(false)->ice_timeout(5000)); const ::Murmur::ServerUpdatingAuthenticatorPrx uprx = ::Murmur::ServerUpdatingAuthenticatorPrx::checkedCast(prx); mi->qmServerAuthenticator[server_id] = prx; @@ -975,7 +975,7 @@ static void impl_Server_addContextCallback(const Murmur::AMD_Server_addContextCa } try { - const Murmur::ServerContextCallbackPrx &oneway = Murmur::ServerContextCallbackPrx::checkedCast(cbptr->ice_oneway()->ice_connectionCached(false)); + const Murmur::ServerContextCallbackPrx &oneway = Murmur::ServerContextCallbackPrx::checkedCast(cbptr->ice_oneway()->ice_connectionCached(false)->ice_timeout(5000)); qmPrx.insert(u8(action), oneway); cb->ice_response(); } catch (...) { @@ -996,7 +996,7 @@ static void impl_Server_removeContextCallback(const Murmur::AMD_Server_removeCon QMap<int, QMap<QString, ::Murmur::ServerContextCallbackPrx> > & qmPrx = mi->qmServerContextCallbacks[server_id]; try { - const Murmur::ServerContextCallbackPrx &oneway = Murmur::ServerContextCallbackPrx::uncheckedCast(cbptr->ice_oneway()->ice_connectionCached(false)); + const Murmur::ServerContextCallbackPrx &oneway = Murmur::ServerContextCallbackPrx::uncheckedCast(cbptr->ice_oneway()->ice_connectionCached(false)->ice_timeout(5000)); foreach(int session, qmPrx.keys()) { QMap<QString, ::Murmur::ServerContextCallbackPrx> qm = qmPrx[session]; @@ -1482,7 +1482,7 @@ static void impl_Meta_getVersion(const ::Murmur::AMD_Meta_getVersionPtr cb, cons static void impl_Meta_addCallback(const Murmur::AMD_Meta_addCallbackPtr cb, const Ice::ObjectAdapterPtr, const Murmur::MetaCallbackPrx& cbptr) { try { - const Murmur::MetaCallbackPrx &oneway = Murmur::MetaCallbackPrx::checkedCast(cbptr->ice_oneway()->ice_connectionCached(false)); + const Murmur::MetaCallbackPrx &oneway = Murmur::MetaCallbackPrx::checkedCast(cbptr->ice_oneway()->ice_connectionCached(false)->ice_timeout(5000)); if (! mi->qmMetaCallbacks.contains(oneway)) mi->qmMetaCallbacks.append(oneway); cb->ice_response(); @@ -1493,7 +1493,7 @@ static void impl_Meta_addCallback(const Murmur::AMD_Meta_addCallbackPtr cb, cons static void impl_Meta_removeCallback(const Murmur::AMD_Meta_removeCallbackPtr cb, const Ice::ObjectAdapterPtr, const Murmur::MetaCallbackPrx& cbptr) { try { - const Murmur::MetaCallbackPrx &oneway = Murmur::MetaCallbackPrx::uncheckedCast(cbptr->ice_oneway()->ice_connectionCached(false)); + const Murmur::MetaCallbackPrx &oneway = Murmur::MetaCallbackPrx::uncheckedCast(cbptr->ice_oneway()->ice_connectionCached(false)->ice_timeout(5000)); mi->qmMetaCallbacks.removeAll(oneway); cb->ice_response(); } catch (...) { |