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)
if (WrappedConnection.get() == NULL)
throw std::logic_error(NotInitializedMessage);
- std::auto_ptr<Client> stub(new Client(*(WrappedConnection->get_connection()),
+ std::auto_ptr<Client> stub(new Client(WrappedConnection->get_connection(),
WrappedConnection->get_command_timeout_usec(),
WrappedConnection->get_hello_timeout_usec()));
ensure_singleton_there();
typename detail::TypeWrap<R>::type result;
+
+ // bind our Client-object and the local result
detail::Call<R> 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<R>::type();
+ }
return result;
}