summaryrefslogtreecommitdiff
path: root/py/modules/IcePy/Operation.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2010-05-21 14:03:30 -0700
committerMark Spruiell <mes@zeroc.com>2010-05-21 14:03:30 -0700
commit01e3d1af5c5e19d74d391a8998495df59f6c4ce8 (patch)
treea94485661f2eb28ce4b1cb29fabf34c3fddf7c8d /py/modules/IcePy/Operation.cpp
parentVarious changes for 3.4.1 installers (diff)
downloadice-01e3d1af5c5e19d74d391a8998495df59f6c4ce8.tar.bz2
ice-01e3d1af5c5e19d74d391a8998495df59f6c4ce8.tar.xz
ice-01e3d1af5c5e19d74d391a8998495df59f6c4ce8.zip
bug 4733 - fixing bugs in AMD exceptions
Diffstat (limited to 'py/modules/IcePy/Operation.cpp')
-rw-r--r--py/modules/IcePy/Operation.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/py/modules/IcePy/Operation.cpp b/py/modules/IcePy/Operation.cpp
index 48bfd56e6a0..b54aeb30f75 100644
--- a/py/modules/IcePy/Operation.cpp
+++ b/py/modules/IcePy/Operation.cpp
@@ -279,6 +279,7 @@ private:
OperationPtr _op;
Ice::AMD_Object_ice_invokePtr _callback;
Ice::CommunicatorPtr _communicator;
+ bool _finished;
};
//
@@ -298,6 +299,7 @@ private:
bool _amd;
Ice::AMD_Object_ice_invokePtr _callback;
+ bool _finished;
};
//
@@ -2864,7 +2866,7 @@ IcePy::OldAsyncBlobjectInvocation::sent(bool)
//
IcePy::TypedUpcall::TypedUpcall(const OperationPtr& op, const Ice::AMD_Object_ice_invokePtr& callback,
const Ice::CommunicatorPtr& communicator) :
- _op(op), _callback(callback), _communicator(communicator)
+ _op(op), _callback(callback), _communicator(communicator), _finished(false)
{
}
@@ -2978,6 +2980,17 @@ IcePy::TypedUpcall::dispatch(PyObject* servant, const pair<const Ice::Byte*, con
void
IcePy::TypedUpcall::response(PyObject* args)
{
+ if(_finished)
+ {
+ //
+ // This method could be called more than once if the application calls
+ // ice_response multiple times. We ignore subsequent calls.
+ //
+ return;
+ }
+
+ _finished = true;
+
try
{
//
@@ -3084,6 +3097,17 @@ IcePy::TypedUpcall::response(PyObject* args)
void
IcePy::TypedUpcall::exception(PyException& ex)
{
+ if(_finished)
+ {
+ //
+ // An asynchronous response or exception has already been sent. We just
+ // raise an exception and let the C++ run time handle it.
+ //
+ ex.raise();
+ }
+
+ _finished = true;
+
try
{
try
@@ -3173,7 +3197,7 @@ IcePy::TypedUpcall::validateException(PyObject* ex) const
// BlobjectUpcall
//
IcePy::BlobjectUpcall::BlobjectUpcall(bool amd, const Ice::AMD_Object_ice_invokePtr& callback) :
- _amd(amd), _callback(callback)
+ _amd(amd), _callback(callback), _finished(false)
{
}
@@ -3304,6 +3328,17 @@ IcePy::BlobjectUpcall::dispatch(PyObject* servant, const pair<const Ice::Byte*,
void
IcePy::BlobjectUpcall::response(PyObject* args)
{
+ if(_finished)
+ {
+ //
+ // This method could be called more than once if the application calls
+ // ice_response multiple times. We ignore subsequent calls.
+ //
+ return;
+ }
+
+ _finished = true;
+
//
// The return value is a tuple of (bool, PyBuffer).
//
@@ -3350,6 +3385,17 @@ IcePy::BlobjectUpcall::response(PyObject* args)
void
IcePy::BlobjectUpcall::exception(PyException& ex)
{
+ if(_finished)
+ {
+ //
+ // An asynchronous response or exception has already been sent. We just
+ // raise an exception and let the C++ run time handle it.
+ //
+ ex.raise();
+ }
+
+ _finished = true;
+
try
{
//