summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Gen.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2009-12-04 10:02:20 +0100
committerBenoit Foucher <benoit@zeroc.com>2009-12-04 10:02:20 +0100
commit97b8898f58ca33ccbf8a24d483c6a7e530c4ac21 (patch)
tree89e4e9d041999d4c0c1b54607826e65e85340fac /cpp/src/slice2cpp/Gen.cpp
parent4089 - IceGrid database corruption. (diff)
downloadice-97b8898f58ca33ccbf8a24d483c6a7e530c4ac21.tar.bz2
ice-97b8898f58ca33ccbf8a24d483c6a7e530c4ac21.tar.xz
ice-97b8898f58ca33ccbf8a24d483c6a7e530c4ac21.zip
Fixed bug 4426 and 4409
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp46
1 files changed, 41 insertions, 5 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index c0dddcce120..6822f587487 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2671,12 +2671,12 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
<< "const ::Ice::LocalObjectPtr& __cookie" << epar;
C << sb;
string flatName = p->flattenedScope() + name + "_name";
- C << nl << "::IceInternal::OutgoingAsyncPtr __result = new ::IceInternal::OutgoingAsync(this, ";
- C << flatName << ", __del, __cookie);";
if(p->returnsData())
{
C << nl << "__checkAsyncTwowayOnly(" << flatName << ");";
}
+ C << nl << "::IceInternal::OutgoingAsyncPtr __result = new ::IceInternal::OutgoingAsync(this, ";
+ C << flatName << ", __del, __cookie);";
C << nl << "try";
C << sb;
C << nl << "__result->__prepare(" << flatName << ", " << operationModeToString(p->sendMode()) << ", __ctx);";
@@ -2860,7 +2860,25 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
<< opScopedAMI << "::__exception);";
C << eb;
}
- C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "0, __del" << epar << ';';
+
+ if(p->returnsData())
+ {
+ C << nl << "::Ice::AsyncResultPtr __ar;";
+ C << nl << "try";
+ C << sb;
+ C << nl << "__checkTwowayOnly(" << flatName << ");";
+ C << nl << "__ar = begin_" << name << spar << argsAMI << "0, __del" << epar << ';';
+ C << eb;
+ C << nl << "catch(const ::Ice::TwowayOnlyException& ex)";
+ C << sb;
+ C << nl << "__ar = new ::IceInternal::OutgoingAsync(this, " << flatName << ", __del, 0);";
+ C << nl << "__ar->__exceptionAsync(ex);";
+ C << eb;
+ }
+ else
+ {
+ C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "0, __del" << epar << ';';
+ }
C << nl << "return __ar->sentSynchronously();";
C << eb;
@@ -2896,8 +2914,26 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
<< opScopedAMI << "::__exception);";
C << eb;
}
- C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "&__ctx" << "__del" << epar
- << ';';
+
+ if(p->returnsData())
+ {
+ C << nl << "::Ice::AsyncResultPtr __ar;";
+ C << nl << "try";
+ C << sb;
+ C << nl << "__checkTwowayOnly(" << flatName << ");";
+ C << nl << "__ar = begin_" << name << spar << argsAMI << "&__ctx" << "__del" << epar << ';';
+ C << eb;
+ C << nl << "catch(const ::Ice::TwowayOnlyException& ex)";
+ C << sb;
+ C << nl << "__ar = new ::IceInternal::OutgoingAsync(this, " << flatName << ", __del, 0);";
+ C << nl << "__ar->__exceptionAsync(ex);";
+ C << eb;
+ }
+ else
+ {
+ C << nl << "::Ice::AsyncResultPtr __ar = begin_" << name << spar << argsAMI << "&__ctx" << "__del" << epar
+ << ';';
+ }
C << nl << "return __ar->sentSynchronously();";
C << eb;
}