summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2009-05-21 13:37:01 -0230
committerDwayne Boone <dwayne@zeroc.com>2009-05-21 13:37:01 -0230
commit504e23cae058310ff340a29595ce8f44d7930cfa (patch)
tree62671c0ac89afc57d26b40649285888a1ecef08f /cpp/src
parentBug 3999 - do not have local struct/enum implement java.io.Serialize (diff)
downloadice-504e23cae058310ff340a29595ce8f44d7930cfa.tar.bz2
ice-504e23cae058310ff340a29595ce8f44d7930cfa.tar.xz
ice-504e23cae058310ff340a29595ce8f44d7930cfa.zip
Bug 3290 - Glacier2 buffered mode and invocation forwarded as oneways
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Glacier2/RequestQueue.cpp48
1 files changed, 27 insertions, 21 deletions
diff --git a/cpp/src/Glacier2/RequestQueue.cpp b/cpp/src/Glacier2/RequestQueue.cpp
index 904f3d6c578..dae1dd30123 100644
--- a/cpp/src/Glacier2/RequestQueue.cpp
+++ b/cpp/src/Glacier2/RequestQueue.cpp
@@ -22,25 +22,33 @@ namespace
//
// AMI callback class for twoway requests
//
-class AMI_Array_Object_ice_invokeI : public AMI_Array_Object_ice_invoke
+class AMI_Array_Object_ice_invokeI : public AMI_Array_Object_ice_invoke, public Ice::AMISentCallback
{
public:
AMI_Array_Object_ice_invokeI(const AMD_Object_ice_invokePtr& amdCB,
const InstancePtr& instance,
- const ConnectionPtr& connection) :
+ const ConnectionPtr& connection,
+ bool oneway) :
_amdCB(amdCB),
_instance(instance),
- _connection(connection)
+ _connection(connection),
+ _oneway(oneway)
{
}
virtual void
ice_response(bool ok, const pair<const Byte*, const Byte*>& outParams)
{
- if(_amdCB)
+ _amdCB->ice_response(ok, outParams);
+ }
+
+ virtual void
+ ice_sent()
+ {
+ if(_oneway)
{
- _amdCB->ice_response(ok, outParams);
+ _amdCB->ice_response(true, pair<const Byte*, const Byte*>(0, 0));
}
}
@@ -77,6 +85,7 @@ private:
const AMD_Object_ice_invokePtr _amdCB;
const InstancePtr _instance;
const ConnectionPtr _connection;
+ const bool _oneway;
};
}
@@ -92,10 +101,9 @@ Glacier2::Request::Request(const ObjectPrx& proxy, const std::pair<const Byte*,
_amdCB(amdCB)
{
//
- // If this is not a twoway call, we can finish the AMD call right
- // away.
+ // If this is a batch call, we can finish the AMD call right away.
//
- if(!_proxy->ice_isTwoway())
+ if(_proxy->ice_isBatchOneway() || _proxy->ice_isBatchDatagram())
{
_amdCB->ice_response(true, pair<const Byte*, const Byte*>(0, 0));
}
@@ -153,40 +161,38 @@ Glacier2::Request::invoke(const InstancePtr& instance, const Ice::ConnectionPtr&
}
else
{
- AMI_Array_Object_ice_invokePtr amiCB;
- if(_proxy->ice_isTwoway())
- {
- amiCB = new AMI_Array_Object_ice_invokeI(_amdCB, instance, connection);
- }
- else
- {
- amiCB = new AMI_Array_Object_ice_invokeI(0, instance, connection);
- }
+ AMI_Array_Object_ice_invokePtr amiCB =
+ new AMI_Array_Object_ice_invokeI(_amdCB, instance, connection, !_proxy->ice_isTwoway());
+ bool sent;
if(_forwardContext)
{
if(_sslContext.size() > 0)
{
Ice::Context ctx = _current.ctx;
ctx.insert(_sslContext.begin(), _sslContext.end());
- _proxy->ice_invoke_async(amiCB, _current.operation, _current.mode, inPair, ctx);
+ sent = _proxy->ice_invoke_async(amiCB, _current.operation, _current.mode, inPair, ctx);
}
else
{
- _proxy->ice_invoke_async(amiCB, _current.operation, _current.mode, inPair, _current.ctx);
+ sent = _proxy->ice_invoke_async(amiCB, _current.operation, _current.mode, inPair, _current.ctx);
}
}
else
{
if(_sslContext.size() > 0)
{
- _proxy->ice_invoke_async(amiCB, _current.operation, _current.mode, inPair, _sslContext);
+ sent = _proxy->ice_invoke_async(amiCB, _current.operation, _current.mode, inPair, _sslContext);
}
else
{
- _proxy->ice_invoke_async(amiCB, _current.operation, _current.mode, inPair);
+ sent = _proxy->ice_invoke_async(amiCB, _current.operation, _current.mode, inPair);
}
}
+ if(sent && !_proxy->ice_isTwoway())
+ {
+ _amdCB->ice_response(true, pair<const Byte*, const Byte*>(0, 0));
+ }
return false; // Not a batch invocation.
}
}