-support noreply messages in the library

-> not yet in the XML file
This commit is contained in:
Andreas Volz 2008-09-10 00:14:38 +02:00
parent bbca1b0acc
commit f51dc1bf4c
6 changed files with 30 additions and 1 deletions

View file

@ -42,7 +42,9 @@ void *greeter_thread(void *arg)
for (int i = 0; i < 30 && spin; ++i)
{
cout << "+Hello" << endl;
cout << client.Hello(idstr) << endl;
cout << "-Hello" << endl;
}
cout << idstr << " done " << endl;

View file

@ -24,7 +24,7 @@ int32_t EchoServer::Random()
std::string EchoServer::Hello(const std::string &name)
{
sleep (10);
sleep (5);
return "Hello " + name + "!";
}

View file

@ -95,6 +95,8 @@ protected:
{}
virtual Message _invoke_method(CallMessage &) = 0;
virtual bool _invoke_method_noreply(CallMessage &call) = 0;
InterfaceProxyTable _interfaces;
};
@ -164,6 +166,8 @@ public:
InterfaceProxy(const std::string &name);
Message invoke_method(const CallMessage &);
bool invoke_method_noreply(const CallMessage &call);
bool dispatch_signal(const SignalMessage &);

View file

@ -201,6 +201,8 @@ public:
private:
Message _invoke_method(CallMessage &);
bool _invoke_method_noreply(CallMessage &call);
bool handle_message(const Message &);

View file

@ -157,3 +157,13 @@ Message InterfaceProxy::invoke_method(const CallMessage &call)
return _invoke_method(call2);
}
bool InterfaceProxy::invoke_method_noreply(const CallMessage &call)
{
CallMessage &call2 = const_cast<CallMessage &>(call);
if (call.interface() == NULL)
call2.interface(name().c_str());
return _invoke_method_noreply(call2);
}

View file

@ -332,6 +332,17 @@ Message ObjectProxy::_invoke_method(CallMessage &call)
return conn().send_blocking(call);
}
bool ObjectProxy::_invoke_method_noreply(CallMessage &call)
{
if (call.path() == NULL)
call.path(path().c_str());
if (call.destination() == NULL)
call.destination(service().c_str());
return conn().send(call);
}
bool ObjectProxy::handle_message(const Message &msg)
{
switch (msg.type())