summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-07-18 23:51:08 +0200
committerJose <jose@zeroc.com>2019-07-18 23:51:08 +0200
commitfc886b010c01cccb8cca3ac4d92f1ebd7fc72295 (patch)
tree51cf00a4a955efecc9c94527aeafcb25ffbe57b9 /cpp/src
parentSimplify OutputStream creation (diff)
parentFixed non-thread safe AMD dispatch, fixes #448 (#449) (diff)
downloadice-fc886b010c01cccb8cca3ac4d92f1ebd7fc72295.tar.bz2
ice-fc886b010c01cccb8cca3ac4d92f1ebd7fc72295.tar.xz
ice-fc886b010c01cccb8cca3ac4d92f1ebd7fc72295.zip
Merge remote-tracking branch 'origin/3.7' into swift
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/DispatchInterceptor.cpp13
-rw-r--r--cpp/src/Ice/Incoming.cpp2
-rw-r--r--cpp/src/Ice/Object.cpp9
-rw-r--r--cpp/src/IceGrid/Activator.cpp34
-rw-r--r--cpp/src/IceGrid/IceGridNode.cpp9
-rw-r--r--cpp/src/IceGrid/PlatformInfo.cpp4
-rw-r--r--cpp/src/IceSSL/OpenSSLTransceiverI.cpp15
-rw-r--r--cpp/src/IceStorm/Subscriber.cpp15
-rw-r--r--cpp/src/IceUtil/UtilException.cpp2
-rw-r--r--cpp/src/IceXML/msbuild/icexml.vcxproj16
-rw-r--r--cpp/src/IceXML/msbuild/packages.config8
-rw-r--r--cpp/src/slice2cs/Gen.cpp53
12 files changed, 139 insertions, 41 deletions
diff --git a/cpp/src/Ice/DispatchInterceptor.cpp b/cpp/src/Ice/DispatchInterceptor.cpp
index 10457e990e9..78e79311631 100644
--- a/cpp/src/Ice/DispatchInterceptor.cpp
+++ b/cpp/src/Ice/DispatchInterceptor.cpp
@@ -21,4 +21,17 @@ Ice::DispatchInterceptor::_iceDispatch(IceInternal::Incoming& in, const Current&
{
return false;
}
+ catch(const std::exception&)
+ {
+ //
+ // If the input parameters weren't read, make sure we skip them here. It's needed to read the
+ // encoding version used by the client to eventually marshal the user exception. It's also needed
+ // if we dispatch a batch oneway request to read the next batch request.
+ //
+ if(in.getCurrent().encoding.major == 0 && in.getCurrent().encoding.minor == 0)
+ {
+ in.skipReadParams();
+ }
+ throw;
+ }
}
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index 1fce4e5f107..b7cc91488d2 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -59,6 +59,8 @@ IceInternal::IncomingBase::IncomingBase(Instance* instance, ResponseHandler* res
_current.con = connection;
#endif
_current.requestId = requestId;
+ _current.encoding.major = 0;
+ _current.encoding.minor = 0;
}
IceInternal::IncomingBase::IncomingBase(IncomingBase& other) :
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index effce176db2..78235ce4d62 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -155,7 +155,14 @@ Ice::Object::_iceD_ice_ids(Incoming& inS, const Current& current)
inS.readEmptyParams();
vector<string> ret = ice_ids(current);
OutputStream* ostr = inS.startWriteParams();
- ostr->write(&ret[0], &ret[0] + ret.size(), false);
+ if(ret.empty())
+ {
+ ostr->write(ret);
+ }
+ else
+ {
+ ostr->write(&ret[0], &ret[0] + ret.size(), false);
+ }
inS.endWriteParams();
return true;
}
diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp
index a9a4508e910..9a9fb38af2b 100644
--- a/cpp/src/IceGrid/Activator.cpp
+++ b/cpp/src/IceGrid/Activator.cpp
@@ -641,25 +641,47 @@ Activator::activate(const string& name,
}
vector<gid_t> groups;
+#ifdef _AIX
+ char* grouplist = getgrset(pw->pw_name);
+ if(grouplist == 0)
+ {
+ throw SyscallException(__FILE__, __LINE__, getSystemErrno());
+ }
+ vector<string> grps;
+ if(IceUtilInternal::splitString(grouplist, ",", grps))
+ {
+ for(vector<string>::const_iterator p = grps.begin(); p != grps.end(); ++p)
+ {
+ gid_t group;
+ istringstream is(*p);
+ if(is >> group)
+ {
+ groups.push_back(group);
+ }
+ }
+ }
+ free(grouplist);
+#else
groups.resize(20);
int ngroups = static_cast<int>(groups.size());
-#if defined(__APPLE__)
+# if defined(__APPLE__)
if(getgrouplist(pw->pw_name, static_cast<int>(gid), reinterpret_cast<int*>(&groups[0]), &ngroups) < 0)
-#else
+# else
if(getgrouplist(pw->pw_name, gid, &groups[0], &ngroups) < 0)
-#endif
+# endif
{
groups.resize(static_cast<size_t>(ngroups));
-#if defined(__APPLE__)
+# if defined(__APPLE__)
getgrouplist(pw->pw_name, static_cast<int>(gid), reinterpret_cast<int*>(&groups[0]), &ngroups);
-#else
+# else
getgrouplist(pw->pw_name, gid, &groups[0], &ngroups);
-#endif
+# endif
}
else
{
groups.resize(static_cast<size_t>(ngroups));
}
+#endif
if(groups.size() > NGROUPS_MAX)
{
diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp
index f80cf673236..9a96452a520 100644
--- a/cpp/src/IceGrid/IceGridNode.cpp
+++ b/cpp/src/IceGrid/IceGridNode.cpp
@@ -32,7 +32,12 @@ using namespace Ice;
using namespace IceInternal;
using namespace IceGrid;
+// Work-around for anonymous namspace bug in xlclang++
+#ifdef __ibmxl__
+namespace IceGridNodeNamespace
+#else
namespace
+#endif
{
class ProcessI : public Process
@@ -110,6 +115,10 @@ setNoIndexingAttribute(const string& path)
}
+#ifdef __ibmxl__
+using namespace IceGridNodeNamespace;
+#endif
+
CollocatedRegistry::CollocatedRegistry(const CommunicatorPtr& com,
const ActivatorPtr& activator,
bool nowarn,
diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp
index 9b265a80eda..5b953d0ebb1 100644
--- a/cpp/src/IceGrid/PlatformInfo.cpp
+++ b/cpp/src/IceGrid/PlatformInfo.cpp
@@ -192,7 +192,7 @@ PlatformInfo::PlatformInfo(const string& prefix,
_last15Total = 0;
#elif defined(_AIX)
struct nlist nl;
- nl.n_name = "avenrun";
+ nl.n_name = const_cast<char*>("avenrun");
nl.n_value = 0;
if(knlist(&nl, 1, sizeof(nl)) == 0)
{
@@ -510,7 +510,7 @@ PlatformInfo::getLoadInfo()
{
long long avenrun[3];
struct nlist nl;
- nl.n_name = "avenrun";
+ nl.n_name = const_cast<char*>("avenrun");
nl.n_value = 0;
if(knlist(&nl, 1, sizeof(nl)) == 0)
{
diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
index 8acfe25a67e..d33bb6aaf52 100644
--- a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
+++ b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
@@ -553,6 +553,21 @@ OpenSSL::TransceiverI::read(IceInternal::Buffer& buf)
int ret = SSL_read(_ssl, reinterpret_cast<void*>(&*buf.i), packetSize);
if(ret <= 0)
{
+#if defined(_AIX)
+ //
+ // WORKAROUND: OpenSSL SSL_read on AIX sometime ends up reporting a error
+ // with SSL_get_error but there's no error in the error queue. This occurs
+ // when SSL_read needs more data. So we just return SocketOperationRead in
+ // this case.
+ //
+ if(SSL_get_error(_ssl, ret) == SSL_ERROR_SSL && ERR_peek_error() == 0)
+ {
+ if(SSL_want_read(_ssl))
+ {
+ return IceInternal::SocketOperationRead;
+ }
+ }
+#endif
switch(SSL_get_error(_ssl, ret))
{
case SSL_ERROR_NONE:
diff --git a/cpp/src/IceStorm/Subscriber.cpp b/cpp/src/IceStorm/Subscriber.cpp
index 0fb46848c3d..9df599eec3c 100644
--- a/cpp/src/IceStorm/Subscriber.cpp
+++ b/cpp/src/IceStorm/Subscriber.cpp
@@ -196,12 +196,16 @@ SubscriberBatch::SubscriberBatch(
_obj(obj),
_interval(instance->flushInterval())
{
- assert(retryCount == 0);
}
void
SubscriberBatch::flush()
{
+ if(_state != SubscriberStateOnline || _events.empty())
+ {
+ return;
+ }
+
if(_outstanding == 0)
{
++_outstanding;
@@ -309,7 +313,6 @@ SubscriberOneway::SubscriberOneway(
Subscriber(instance, rec, proxy, retryCount, 5),
_obj(obj)
{
- assert(retryCount == 0);
}
void
@@ -605,18 +608,10 @@ Subscriber::create(
}
else if(newObj->ice_isOneway() || newObj->ice_isDatagram())
{
- if(retryCount > 0)
- {
- throw BadQoS("non-zero retryCount QoS requires a twoway proxy");
- }
subscriber = new SubscriberOneway(instance, rec, proxy, retryCount, newObj);
}
else if(newObj->ice_isBatchOneway() || newObj->ice_isBatchDatagram())
{
- if(retryCount > 0)
- {
- throw BadQoS("non-zero retryCount QoS requires a twoway proxy");
- }
subscriber = new SubscriberBatch(instance, rec, proxy, retryCount, newObj);
}
else //if(newObj->ice_isTwoway())
diff --git a/cpp/src/IceUtil/UtilException.cpp b/cpp/src/IceUtil/UtilException.cpp
index f42b86f89a6..266942bb3de 100644
--- a/cpp/src/IceUtil/UtilException.cpp
+++ b/cpp/src/IceUtil/UtilException.cpp
@@ -43,7 +43,7 @@
# endif
# endif
-# if !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__) && !defined(ICE_STATIC_LIBS)
+# if !defined(_AIX) && !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__) && !defined(ICE_STATIC_LIBS)
# include <execinfo.h>
# include <cxxabi.h>
# include <stdint.h>
diff --git a/cpp/src/IceXML/msbuild/icexml.vcxproj b/cpp/src/IceXML/msbuild/icexml.vcxproj
index 0b04894330c..899c917c403 100644
--- a/cpp/src/IceXML/msbuild/icexml.vcxproj
+++ b/cpp/src/IceXML/msbuild/icexml.vcxproj
@@ -96,19 +96,19 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
- <Import Project="..\..\..\msbuild\packages\expat.v120.2.2.6\build\native\expat.v120.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v120.2.2.6\build\native\expat.v120.targets')" />
- <Import Project="..\..\..\msbuild\packages\expat.v140.2.2.6\build\native\expat.v140.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v140.2.2.6\build\native\expat.v140.targets')" />
- <Import Project="..\..\..\msbuild\packages\expat.v141.2.2.6\build\native\expat.v141.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v141.2.2.6\build\native\expat.v141.targets')" />
- <Import Project="..\..\..\msbuild\packages\expat.v142.2.2.6\build\native\expat.v142.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v142.2.2.6\build\native\expat.v142.targets')" />
+ <Import Project="..\..\..\msbuild\packages\expat.v120.2.2.7\build\native\expat.v120.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v120.2.2.7\build\native\expat.v120.targets')" />
+ <Import Project="..\..\..\msbuild\packages\expat.v140.2.2.7\build\native\expat.v140.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v140.2.2.7\build\native\expat.v140.targets')" />
+ <Import Project="..\..\..\msbuild\packages\expat.v141.2.2.7\build\native\expat.v141.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v141.2.2.7\build\native\expat.v141.targets')" />
+ <Import Project="..\..\..\msbuild\packages\expat.v142.2.2.7\build\native\expat.v142.targets" Condition="Exists('..\..\..\msbuild\packages\expat.v142.2.2.7\build\native\expat.v142.targets')" />
</ImportGroup>
<Import Project="$(MSBuildThisFileDirectory)..\..\..\msbuild\ice.sign.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
- <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v120.2.2.6\build\native\expat.v120.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v120.2.2.6\build\native\expat.v120.targets'))" />
- <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v140.2.2.6\build\native\expat.v140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v140.2.2.6\build\native\expat.v140.targets'))" />
- <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v141.2.2.6\build\native\expat.v141.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v141.2.2.6\build\native\expat.v141.targets'))" />
- <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v142.2.2.6\build\native\expat.v142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v142.2.2.6\build\native\expat.v142.targets'))" />
+ <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v120.2.2.7\build\native\expat.v120.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v120.2.2.7\build\native\expat.v120.targets'))" />
+ <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v140.2.2.7\build\native\expat.v140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v140.2.2.7\build\native\expat.v140.targets'))" />
+ <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v141.2.2.7\build\native\expat.v141.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v141.2.2.7\build\native\expat.v141.targets'))" />
+ <Error Condition="!Exists('..\..\..\msbuild\packages\expat.v142.2.2.7\build\native\expat.v142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\msbuild\packages\expat.v142.2.2.7\build\native\expat.v142.targets'))" />
</Target>
</Project> \ No newline at end of file
diff --git a/cpp/src/IceXML/msbuild/packages.config b/cpp/src/IceXML/msbuild/packages.config
index 2243cad2c74..1b1bbf027c3 100644
--- a/cpp/src/IceXML/msbuild/packages.config
+++ b/cpp/src/IceXML/msbuild/packages.config
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="expat.v120" version="2.2.6" targetFramework="native" />
- <package id="expat.v140" version="2.2.6" targetFramework="native" />
- <package id="expat.v141" version="2.2.6" targetFramework="native" />
- <package id="expat.v142" version="2.2.6" targetFramework="native" />
+ <package id="expat.v120" version="2.2.7" targetFramework="native" />
+ <package id="expat.v140" version="2.2.7" targetFramework="native" />
+ <package id="expat.v141" version="2.2.7" targetFramework="native" />
+ <package id="expat.v142" version="2.2.7" targetFramework="native" />
</packages> \ No newline at end of file
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 221b3121fc7..dcb2e3c5006 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -3386,6 +3386,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
bool isProperty = false;
bool isValue = false;
bool isProtected = false;
+ bool isPrivate = false;
const bool isOptional = p->optional();
ContainedPtr cont = ContainedPtr::dynamicCast(p->container());
assert(cont);
@@ -3398,7 +3399,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
if(st)
{
isLocal = st->isLocal();
- isValue = isValueType(StructPtr::dynamicCast(cont));
+ isValue = isValueType(st);
if(!isValue)
{
baseTypes = DotNet::ICloneable;
@@ -3407,6 +3408,22 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
isProperty = true;
}
+ //
+ // C# structs are implicit sealed and cannot use `protected' modifier,
+ // we must use either public or private. For Slice structs using the
+ // class mapping we can still use protected modifier.
+ //
+ if(cont->hasMetaData("protected") || p->hasMetaData("protected"))
+ {
+ if(isValue)
+ {
+ isPrivate = true;
+ }
+ else
+ {
+ isProtected = true;
+ }
+ }
}
else if(ex)
{
@@ -3433,6 +3450,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
string type = typeToString(p->type(), ns, isOptional, isLocal, p->getMetaData());
string propertyName = fixId(p->name(), baseTypes, isClass);
string dataMemberName;
+
if(isProperty)
{
dataMemberName = "_" + p->name();
@@ -3446,17 +3464,22 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
_out << nl << "private";
}
- else if(isProtected)
- {
- emitAttributes(p);
- emitGeneratedCodeAttribute();
- _out << nl << "protected";
- }
else
{
emitAttributes(p);
emitGeneratedCodeAttribute();
- _out << nl << "public";
+ if(isPrivate)
+ {
+ _out << nl << "private";
+ }
+ else if(isProtected)
+ {
+ _out << nl << "protected";
+ }
+ else
+ {
+ _out << nl << "public";
+ }
}
if(isOptional && isValue)
@@ -3472,7 +3495,19 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
emitAttributes(p);
emitGeneratedCodeAttribute();
- _out << nl << (isProtected ? "protected" : "public");
+ if(isPrivate)
+ {
+ _out << nl << "private";
+ }
+ else if(isProtected)
+ {
+ _out << nl << "protected";
+ }
+ else
+ {
+ _out << nl << "public";
+ }
+
if(!isValue)
{
_out << " virtual";