diff options
author | Michi Henning <michi@zeroc.com> | 2006-01-19 02:27:27 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2006-01-19 02:27:27 +0000 |
commit | c10d339f366ce8b63f5f486665d072ccff0ad635 (patch) | |
tree | c8d064dd1bc4cf48c587fbfc0e8edcd07b3b770e /cpp/src | |
parent | porting changes for bug 764 (diff) | |
download | ice-c10d339f366ce8b63f5f486665d072ccff0ad635.tar.bz2 ice-c10d339f366ce8b63f5f486665d072ccff0ad635.tar.xz ice-c10d339f366ce8b63f5f486665d072ccff0ad635.zip |
Bug 341.
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/OutgoingAsync.cpp | 5 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 23 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 9 | ||||
-rwxr-xr-x | cpp/src/slice2cs/Gen.cpp | 9 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 7 | ||||
-rwxr-xr-x | cpp/src/slice2vb/Gen.cpp | 9 |
6 files changed, 27 insertions, 35 deletions
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 736d4b4f28b..fca226a66be 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -284,6 +284,11 @@ IceInternal::OutgoingAsync::__prepare(const ObjectPrx& prx, const string& operat _monitor.wait(); } + // + // Can't call async via a oneway proxy. + // + prx->__checkTwowayOnly(operation); + _reference = prx->__reference(); assert(!_connection); _connection = _reference->getConnection(_compress); diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 61577f7351d..6524a4ce9c3 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -320,7 +320,6 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb, const vector<Byte>& inParams, const Context& context) { - __checkTwowayOnly("ice_invoke_async"); cb->__invoke(this, operation, mode, inParams, context); } @@ -766,6 +765,12 @@ IceProxy::Ice::Object::__rethrowException(const LocalException& ex) ex.ice_throw(); } +// +// Overloaded for const char* and const string& because, most of time, +// we call this with a const char* and we want to avoid the overhead +// of constructing a string. +// + void IceProxy::Ice::Object::__checkTwowayOnly(const char* name) const { @@ -782,6 +787,22 @@ IceProxy::Ice::Object::__checkTwowayOnly(const char* name) const } } +void +IceProxy::Ice::Object::__checkTwowayOnly(const string& name) const +{ + // + // No mutex lock necessary, there is nothing mutable in this + // operation. + // + + if(!ice_isTwoway()) + { + TwowayOnlyException ex(__FILE__, __LINE__); + ex.operation = name; + throw ex; + } +} + ostream& operator<<(ostream& os, const ::IceProxy::Ice::Object& p) { diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 8ac6d2f6ba1..c5649df1a49 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -4177,15 +4177,6 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) C << sb; C << nl << "static const ::std::string __operation(\"" << name << "\");"; C << nl << "__prepare(__prx, " << flatName << ", " << operationModeToString(p->mode()) << ", __ctx);"; - if(p->returnsData()) - { - C << nl << "if(!__prx->ice_isTwoway())"; - C << sb; - C << nl << "::Ice::TwowayOnlyException ex(__FILE__, __LINE__);"; - C << nl << "ex.operation = __operation;"; - C << nl << "throw ex;"; - C << eb; - } writeMarshalCode(C, inParams, 0); if(p->sendsClasses()) { diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 478ab219b86..ac459e16e77 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -4344,15 +4344,6 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) _out << nl << "try"; _out << sb; _out << nl << "prepare__(prx__, \"" << name << "\", " << sliceModeToIceMode(p) << ", ctx__);"; - if(p->returnsData()) - { - _out << nl << "if(!prx__.ice_isTwoway())"; - _out << sb; - _out << nl << "Ice.TwowayOnlyException ex = new Ice.TwowayOnlyException();"; - _out << nl << "ex.operation = \"" << name << "\";"; - _out << nl << "throw ex;"; - _out << eb; - } for(q = inParams.begin(); q != inParams.end(); ++q) { string typeS = typeToString(q->first); diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 0e8418cf660..648dd82c3b8 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -4551,13 +4551,6 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) out << nl << "try"; out << sb; out << nl << "__prepare(__prx, \"" << p->name() << "\", " << sliceModeToIceMode(p) << ", __ctx);"; - if(p->returnsData()) - { - out << nl << "if(!__prx.ice_isTwoway())"; - out << sb; - out << nl << "throw new Ice.TwowayOnlyException(\"" << p->name() << "\");"; - out << eb; - } iter = 0; for(pli = inParams.begin(); pli != inParams.end(); ++pli) { diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp index bc5e5f1dba1..e0c1b5bf525 100755 --- a/cpp/src/slice2vb/Gen.cpp +++ b/cpp/src/slice2vb/Gen.cpp @@ -4829,15 +4829,6 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) _out.inc(); _out << nl << "prepare__(prx__, \"" << p->name() << "\", " << sliceModeToIceMode(p) << ", ctx__)"; if(p->returnsData()) - { - _out << nl << "If Not prx__.ice_isTwoway() Then"; - _out.inc(); - _out << nl << "Dim ex As Ice.TwowayOnlyException = New Ice.TwowayOnlyException()"; - _out << nl << "ex.operation = \"" << p->name() << "\""; - _out << nl << "Throw ex"; - _out.dec(); - _out << nl << "End If"; - } for(q = inParams.begin(); q != inParams.end(); ++q) { string typeS = typeToString(q->first); |