X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fclient_wrapper.hxx;h=ebc9e254502169cfce98af82bc4a275cc654df41;hp=672308e7cd17484e3f46393eec95a8de654aa52f;hb=fb3345ada7ea94225b78994fd50e3de693a2a3d5;hpb=4c3662a0b083759056b93c21e747e5551a8ddfcc diff --git a/src/client_wrapper.hxx b/src/client_wrapper.hxx index 672308e..ebc9e25 100644 --- a/src/client_wrapper.hxx +++ b/src/client_wrapper.hxx @@ -59,9 +59,10 @@ class ConnectionWrapper virtual client_connection* get_connection()=0; - virtual void handle(command_client* stubBase, boost::function< void() > f) + virtual bool handle(command_client* stubBase, boost::function< void() > f) { f(); + return true; } long long get_command_timeout_usec(void) @@ -179,7 +180,7 @@ class T2nSingletonWrapper : public T2nSingletonWrapperMessages if (WrappedConnection.get() == NULL) throw std::logic_error(NotInitializedMessage); - std::auto_ptr stub(new Client(*(WrappedConnection->get_connection()), + std::auto_ptr stub(new Client(WrappedConnection->get_connection(), WrappedConnection->get_command_timeout_usec(), WrappedConnection->get_hello_timeout_usec())); @@ -193,8 +194,17 @@ class T2nSingletonWrapper : public T2nSingletonWrapperMessages ensure_singleton_there(); typename detail::TypeWrap::type result; + + // bind our Client-object and the local result detail::Call call( boost::bind( f, SingletonObject->Stub.get()), result ); - WrappedConnection->handle(SingletonObject->Stub.get(),call); + + // let the wrapper-handler call the fully-bound function + if (!WrappedConnection->handle(SingletonObject->Stub.get(),call)) + { + // create an result with default-constructor if the handler could not + // successfully do a call but no exception occured + result=typename detail::TypeWrap::type(); + } return result; }