diff options
author | Jose <jose@zeroc.com> | 2016-05-09 23:03:21 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-05-09 23:03:21 +0200 |
commit | 3e685a12bfd92a4ffd86c808ba0f34df907de5c8 (patch) | |
tree | 2ef8fb8e028d4f14d1516a98f2a18dbadb46a5d7 | |
parent | Update to latest gradle builder (diff) | |
parent | AIX port (diff) | |
download | ice-3e685a12bfd92a4ffd86c808ba0f34df907de5c8.tar.bz2 ice-3e685a12bfd92a4ffd86c808ba0f34df907de5c8.tar.xz ice-3e685a12bfd92a4ffd86c808ba0f34df907de5c8.zip |
Merge remote-tracking branch 'origin/3.6'
81 files changed, 900 insertions, 361 deletions
diff --git a/CHANGELOG-3.6.md b/CHANGELOG-3.6.md index 24b47710c36..5121da71caa 100644 --- a/CHANGELOG-3.6.md +++ b/CHANGELOG-3.6.md @@ -39,11 +39,21 @@ particular aspect of Ice. These are the changes since Ice 3.6.2. +## General Changes + +- Fixed a bug in the un-marshalling code where passing optional input + parameters to an operation with no required input parameters would + cause an Ice::EncapsulationException to be thrown if the receiver + didn't expect the optional input parameters. The same applies for + passing optional output parameters to operations without required + output parameters. + + ## C++ Changes - Added support for archiving log files. The property Ice.LogFile.SizeMax controls the maximum size in bytes of log files; when a log file reaches - this size, the log file is renamed and a new log file is started. + this size, the log file is renamed and a new log file is started. The Ice.LogFile.SizeMax property is set to 0 by default, which means the log file size is unlimited and a single log file is created. diff --git a/cpp/BuildInstructionsAIX.md b/cpp/BuildInstructionsAIX.md new file mode 100644 index 00000000000..cda7de3ab76 --- /dev/null +++ b/cpp/BuildInstructionsAIX.md @@ -0,0 +1,207 @@ +# Building Ice for C++ on AIX + +This document provides step-by-step instructions for building Ice for C++ +from sources on AIX. + +## Unsupported Platform + +AIX is currently an unsupported platform. Only minimal testing was performed +on AIX, and there is no guarantee future releases of Ice will build or run +on this platform. + +## Recommended Operating System and C++ Compiler + + - AIX 6.1, AIX 7.1 + - IBM XL C/C++ 12.1 with latest Fix Pack + - 32 bit or 64 bit + +## Build Pre-Requisites + +Before building Ice, you need to install or build a number of third-party +packages that Ice depends on, and install some build tools. + +### Third-Party Packages + +Ice depends on several open-source packages: Berkeley DB 5.3, bzip2 1.0, +expat 2.x, mcpp 2.7.2 (+patches) and OpenSSL. + +OpenSSL is a system package on AIX. RPM packages for bzip2 and expat are +available in the [AIX Toolbox for Linux Applications][1]. You can install +them as follows: + +``` +# As root +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/bzip2/bzip2-1.0.5-3.aix5.3.ppc.rpm +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/expat/expat-2.0.1-2.aix5.3.ppc.rpm +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/expat/expat-devel-2.0.1-2.aix5.3.ppc.rpm + +``` + +Berkeley DB and mcpp must be built from sources, as described below. + +### Build Tools + +You need GNU make (gmake) to build Ice: +``` +# As root +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/make/make-4.1-2.aix6.1.ppc.rpm +``` + +The preferred way to retrieve the Ice and mcpp source distributions is with +git. A RPM for git is available from [bullfreeware.com][2]. + +You also need wget, GNU tar and GNU patch to retrieve and build Berkeley DB: +``` +# As root +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/wget/wget-1.9.1-1.aix5.1.ppc.rpm +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/tar/tar-1.22-1.aix6.1.ppc.rpm +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/patch/patch-2.5.4-4.aix4.3.ppc.rpm +``` + +### Building mcpp from Sources + +If building 64-bit binaries, set `OBJECT_MODE` to 64: +``` +export OBJECT_MODE=64 +``` +Otherwise, leave `OBJECT_MODE` unset. + +Then clone the zeroc-ice/mcpp repository and build with gmake: +``` +git clone https://github.com/zeroc-ice/mcpp.git +cd mcpp +gmake +``` + +This build creates a static library, `lib/libmcpp.a`. `libmcpp.a` is used +only when building Ice from sources, and does not need to be installed. + +### Building Berkeley DB from Sources + +#### Download Sources + +Download the Berkeley DB 5.3.28 source archive from [Oracle][3] or ZeroC. You +may use the distribution with encryption or without encryption. Since Ice does +not use Berkeley DB's encryption features, we recommend downloading the +no-encryption (-NC) source archive: + +``` +wget http://zeroc.com/download/berkeley-db/db-5.3.28.NC.tar.gz +``` + +Then unpack this archive: +``` +gtar xzf db-5.3.28.NC.tar.gz +``` + +#### Patch + +Patch Berkeley DB with GNU patch: +``` +wget http://zeroc.com/download/berkeley-db/berkeley-db.5.3.28.patch +cd db-5.3.28.NC +/opt/freeware/bin/patch -p0 < ../berkeley-db.5.3.28.patch +``` + +#### Configure + +If building 64-bit binaries, set `OBJECT_MODE` to 64: +``` +export OBJECT_MODE=64 +``` +Otherwise, leave `OBJECT_MODE` unset. + +Then configure Berkeley DB with C++ support, and set the installation prefix, +for example: +``` +cd build_unix +../dist/configure --enable-cxx --prefix=/opt/db53 +``` + +#### Build and Install +``` +gmake +... + +# run gmake install as root or change permissions on /opt/db53 before install +gmake install +``` + +## Building Ice for C++ + +### Clone zeroc-ice/ice + +``` +git clone -b 3.6 https://github.com/zeroc-ice/ice.git +cd ice/cpp +``` + +### Configure + +Edit `config/Make.rules` to establish your build configuration. The comments +in the file provide more information. + +Make sure to set `DB_HOME` to your Berkeley DB 5.3 installation directory +(`/opt/db53` if built as described above), and `MCPP_HOME` to your mcpp build +directory (for example `$(HOME)/builds/mcpp`). + +`LP64` is not used on AIX. To build 64 bit binaries, set the environment +variable `OBJECT_MODE` to 64: +``` +export OBJECT_MODE=64 +``` +Otherwise, leave this environment variable unset. + +### Build + +Use the gmake `-j` option to speed up the build: + +``` +gmake -j8 +``` + +This builds the Ice core libraries, services, and tests. + +### Install + +``` +gmake install +``` + +This installs Ice for C++ in the directory specified by `prefix` in +`config/Make.rules`. By default, all Ice binaries embed the library path +`prefix/lib:$DB_HOME/lib:/usr/lib`. + +After installation, make sure that the `prefix/bin` directory is in your `PATH`. + +### Run the Test Suite (Optional) + +Python is required to run the test suite. You can install Python as follows: +``` +# As root +rpm -i ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/python-2.7.10-1.aix6.1.ppc.rpm +rpm -i ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/python-tools-2.7.10-1.aix6.1.ppc.rpm +rpm -i ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/python-devel-2.7.10-1.aix6.1.ppc.rpm +``` + +Additionally, the Glacier2 tests require the Python module `passlib`, available +from the Python Package Index: +``` +# As root +wget https://bootstrap.pypa.io/get-pip.py +python get-pip.py +export PATH=/opt/freeware/bin:$PATH +pip install passlib +``` + +Then run the test suite with: +``` +python allTests.py +``` + +If everything worked out, you should see lots of `ok` messages. In case of a +failure, the tests abort with `failed`. + +[1]: http://www-03.ibm.com/systems/power/software/aix/linux +[2]: http://www.bullfreeware.com +[3]: http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html diff --git a/cpp/include/Ice/SlicedData.h b/cpp/include/Ice/SlicedData.h index beffe4b0a5b..597cd0e5f02 100644 --- a/cpp/include/Ice/SlicedData.h +++ b/cpp/include/Ice/SlicedData.h @@ -77,11 +77,14 @@ public: // // Unknown sliced object holds instance of unknown type. // -class ICE_API UnknownSlicedObject -#ifdef ICE_CPP11_MAPPING - : public ValueHelper<UnknownSlicedObject, Value> +class ICE_API UnknownSlicedObject : +#if defined(ICE_CPP11_MAPPING) + public ValueHelper<UnknownSlicedObject, Value> +#elif defined(__IBMCPP__) +// xlC does not handle properly the public/private multiple inheritance from Object + public IceInternal::GCObject #else - : public virtual Object, private IceInternal::GCObject + virtual public Object, private IceInternal::GCObject #endif { public: diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 08e52b9db40..37fa7f033d3 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -182,6 +182,16 @@ # include <TargetConditionals.h> #endif +#if defined(_AIX) && defined(_LARGE_FILES) + // defines macros such as open that we want to use consistently everywhere +# include <fcntl.h> +#endif + +#ifdef __IBMCPP__ +// TODO: better fix for this warning +# pragma report(disable, "1540-0198") // private inheritance without private keyword +#endif + // // The Ice version. // diff --git a/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp b/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp index af9630db528..9bc1ea38a5c 100644 --- a/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp +++ b/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp @@ -14,8 +14,9 @@ #include <IceUtil/FileUtil.h> #include <IceUtil/StringUtil.h> #include <IceUtil/InputUtil.h> +#include <IceUtil/Mutex.h> -#if defined(__GLIBC__) +#if defined(__GLIBC__) || defined(_AIX) # include <crypt.h> #elif defined(__APPLE__) # include <CoreFoundation/CoreFoundation.h> @@ -44,6 +45,7 @@ public: private: const map<string, string> _passwords; + IceUtil::Mutex _cryptMutex; // for old thread-unsafe crypt() }; class CryptPermissionsVerifierPlugin : public Ice::Plugin @@ -51,12 +53,12 @@ class CryptPermissionsVerifierPlugin : public Ice::Plugin public: CryptPermissionsVerifierPlugin(const CommunicatorPtr&); - + virtual void initialize(); virtual void destroy(); private: - + CommunicatorPtr _communicator; }; @@ -165,7 +167,7 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string& struct crypt_data data; data.initialized = 0; return p->second == crypt_r(password.c_str(), salt.c_str(), &data); -#elif defined(__APPLE__) || defined(_WIN32) +#elif defined(__APPLE__) || defined(_WIN32) // // Pbkdf2 string format: // @@ -174,7 +176,7 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string& // size_t beg = 0; size_t end = 0; - + // // Determine the digest algorithm // @@ -373,7 +375,7 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string& vector<BYTE> passwordBuffer(password.begin(), password.end()); - DWORD status = BCryptDeriveKeyPBKDF2(algorithmHandle, &passwordBuffer[0], + DWORD status = BCryptDeriveKeyPBKDF2(algorithmHandle, &passwordBuffer[0], static_cast<DWORD>(passwordBuffer.size()), &saltBuffer[0], saltLength, rounds, &checksumBuffer1[0], static_cast<DWORD>(checksumLength), 0); @@ -388,7 +390,7 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string& DWORD checksumBuffer2Length = checksumLength; vector<BYTE> checksumBuffer2(checksumLength); - if(!CryptStringToBinary(checksum.c_str(), static_cast<DWORD>(checksum.size()), + if(!CryptStringToBinary(checksum.c_str(), static_cast<DWORD>(checksum.size()), CRYPT_STRING_BASE64, &checksumBuffer2[0], &checksumBuffer2Length, 0, 0)) { @@ -397,7 +399,17 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string& return checksumBuffer1 == checksumBuffer2; # endif #else -# error Password hashing not implemented + // Fallback to plain crypt() - DES-style + + if(p->second.size() != 13) + { + return false; + } + string salt = p->second.substr(0, 2); + + IceUtil::Mutex::Lock lock(_cryptMutex); + return p->second == crypt(password.c_str(), salt.c_str()); + #endif } @@ -412,13 +424,13 @@ CryptPermissionsVerifierPlugin::initialize() { const string prefix = "Glacier2CryptPermissionsVerifier."; const PropertyDict props = _communicator->getProperties()->getPropertiesForPrefix(prefix); - + if(!props.empty()) { ObjectAdapterPtr adapter = _communicator->createObjectAdapter(""); // colloc-only adapter - + // Each prop represents a property to set + the associated password file - + for(PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p) { string name = p->first.substr(prefix.size()); @@ -426,9 +438,9 @@ CryptPermissionsVerifierPlugin::initialize() id.name = IceUtil::generateUUID(); id.category = "Glacier2CryptPermissionsVerifier"; ObjectPrx prx = adapter->add(new CryptPermissionsVerifierI(retrievePasswordMap(p->second)), id); - _communicator->getProperties()->setProperty(name, _communicator->proxyToString(prx)); + _communicator->getProperties()->setProperty(name, _communicator->proxyToString(prx)); } - + adapter->activate(); } } @@ -463,7 +475,7 @@ createCryptPermissionsVerifier(const CommunicatorPtr& communicator, const string out << "Plugin " << name << ": too many arguments"; return 0; } - + return new CryptPermissionsVerifierPlugin(communicator); } diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 78370ed4b50..43dc7f670ce 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -875,26 +875,10 @@ IceInternal::OutgoingConnectionFactory::ConnectCallback::connectionStartFailed(c const LocalException& ex) { assert(_iter != _connectors.end()); - - if(_observer) - { - _observer->failed(ex.ice_id()); - _observer->detach(); - } - - _factory->handleConnectionException(ex, _hasMore || _iter != _connectors.end() - 1); - if(dynamic_cast<const Ice::CommunicatorDestroyedException*>(&ex)) // No need to continue. - { - _factory->finishGetConnection(_connectors, ex, shared_from_this()); - } - else if(++_iter != _connectors.end()) // Try the next connector. + if(connectionStartFailedImpl(ex)) { nextConnector(); } - else - { - _factory->finishGetConnection(_connectors, ex, shared_from_this()); - } } // @@ -1020,39 +1004,46 @@ IceInternal::OutgoingConnectionFactory::ConnectCallback::getConnection() void IceInternal::OutgoingConnectionFactory::ConnectCallback::nextConnector() { - Ice::ConnectionIPtr connection; - try + while(true) { - const CommunicatorObserverPtr& obsv = _factory->_instance->initializationData().observer; - if(obsv) + try { - _observer = obsv->getConnectionEstablishmentObserver(_iter->endpoint, _iter->connector->toString()); - if(_observer) + const CommunicatorObserverPtr& obsv = _factory->_instance->initializationData().observer; + if(obsv) { - _observer->attach(); + _observer = obsv->getConnectionEstablishmentObserver(_iter->endpoint, _iter->connector->toString()); + if(_observer) + { + _observer->attach(); + } } - } - assert(_iter != _connectors.end()); + assert(_iter != _connectors.end()); - if(_instance->traceLevels()->network >= 2) - { - Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); - out << "trying to establish " << _iter->endpoint->protocol() << " connection to " - << _iter->connector->toString(); + if(_instance->traceLevels()->network >= 2) + { + Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); + out << "trying to establish " << _iter->endpoint->protocol() << " connection to " + << _iter->connector->toString(); + } + Ice::ConnectionIPtr connection = _factory->createConnection(_iter->connector->connect(), *_iter); + connection->start(ICE_SHARED_FROM_THIS); } - connection = _factory->createConnection(_iter->connector->connect(), *_iter); - connection->start(ICE_SHARED_FROM_THIS); - } - catch(const Ice::LocalException& ex) - { - if(_instance->traceLevels()->network >= 2) + catch(const Ice::LocalException& ex) { - Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); - out << "failed to establish " << _iter->endpoint->protocol() << " connection to " - << _iter->connector->toString() << "\n" << ex; + if(_instance->traceLevels()->network >= 2) + { + Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); + out << "failed to establish " << _iter->endpoint->protocol() << " connection to " + << _iter->connector->toString() << "\n" << ex; + } + + if(connectionStartFailedImpl(ex)) + { + continue; // More connectors to try, continue. + } } - connectionStartFailed(connection, ex); + break; } } @@ -1111,6 +1102,31 @@ IceInternal::OutgoingConnectionFactory::ConnectCallback::operator<(const Connect return this < &rhs; } +bool +IceInternal::OutgoingConnectionFactory::ConnectCallback::connectionStartFailedImpl(const Ice::LocalException& ex) +{ + if(_observer) + { + _observer->failed(ex.ice_id()); + _observer->detach(); + } + + _factory->handleConnectionException(ex, _hasMore || _iter != _connectors.end() - 1); + if(dynamic_cast<const Ice::CommunicatorDestroyedException*>(&ex)) // No need to continue. + { + _factory->finishGetConnection(_connectors, ex, ICE_SHARED_FROM_THIS); + } + else if(++_iter != _connectors.end()) // Try the next connector. + { + return true; + } + else + { + _factory->finishGetConnection(_connectors, ex, ICE_SHARED_FROM_THIS); + } + return false; +} + void IceInternal::IncomingConnectionFactory::activate() { diff --git a/cpp/src/Ice/ConnectionFactory.h b/cpp/src/Ice/ConnectionFactory.h index 1838d213d51..578c728559b 100644 --- a/cpp/src/Ice/ConnectionFactory.h +++ b/cpp/src/Ice/ConnectionFactory.h @@ -119,6 +119,8 @@ private: private: + bool connectionStartFailedImpl(const Ice::LocalException&); + const InstancePtr _instance; const OutgoingConnectionFactoryPtr _factory; const std::vector<EndpointIPtr> _endpoints; diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index a5d3d74f206..089a8ee0871 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -63,7 +63,7 @@ # include <sys/types.h> #endif -#if defined(__linux) || defined(__sun) +#if defined(__linux) || defined(__sun) || defined(_AIX) # include <grp.h> // for initgroups #endif diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 402471be2ef..d1da40b9b51 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -1286,7 +1286,6 @@ IceInternal::fdToLocalAddress(SOCKET fd, Address& addr) socklen_t len = static_cast<socklen_t>(sizeof(sockaddr_storage)); if(getsockname(fd, &addr.sa, &len) == SOCKET_ERROR) { - closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; @@ -1320,7 +1319,6 @@ IceInternal::fdToRemoteAddress(SOCKET fd, Address& addr) } else { - closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; @@ -2339,12 +2337,20 @@ repeatConnect: // port as the server). // Address localAddr; - fdToLocalAddress(fd, localAddr); - if(compareAddress(addr, localAddr) == 0) + try { - ConnectionRefusedException ex(__FILE__, __LINE__); - ex.error = 0; // No appropriate errno - throw ex; + fdToLocalAddress(fd, localAddr); + if(compareAddress(addr, localAddr) == 0) + { + ConnectionRefusedException ex(__FILE__, __LINE__); + ex.error = 0; // No appropriate errno + throw ex; + } + } + catch(const LocalException&) + { + closeSocketNoThrow(fd); + throw; } #endif return true; diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp index e7b75bd4ade..e70012fd391 100644 --- a/cpp/src/Ice/PluginManagerI.cpp +++ b/cpp/src/Ice/PluginManagerI.cpp @@ -479,6 +479,12 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, St ex.reason = out.str(); throw ex; } + +#ifdef __IBMCPP__ + // xlC warns when casting a void* to function pointer +# pragma report(disable, "1540-0216") +#endif + factory = reinterpret_cast<PluginFactory>(sym); } diff --git a/cpp/src/Ice/RetryQueue.cpp b/cpp/src/Ice/RetryQueue.cpp index 9c81aa1bead..f74988f65a9 100644 --- a/cpp/src/Ice/RetryQueue.cpp +++ b/cpp/src/Ice/RetryQueue.cpp @@ -116,7 +116,7 @@ IceInternal::RetryQueue::destroy() Lock sync(*this); assert(_instance); - set<RetryTaskPtr>::const_iterator p = _requests.begin(); + set<RetryTaskPtr>::iterator p = _requests.begin(); while(p != _requests.end()) { if(_instance->timer()->cancel(*p)) diff --git a/cpp/src/Ice/StreamSocket.cpp b/cpp/src/Ice/StreamSocket.cpp index e11d5709aa4..fa3761f5fa0 100644 --- a/cpp/src/Ice/StreamSocket.cpp +++ b/cpp/src/Ice/StreamSocket.cpp @@ -32,10 +32,18 @@ StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, #ifndef ICE_USE_IOCP if(doConnect(_fd, _proxy ? _proxy->getAddress() : _addr, sourceAddr)) { - _state = StateConnected; + _state = _proxy ? StateProxyWrite : StateConnected; } #endif - _desc = fdToString(_fd, _proxy, _addr); + try + { + _desc = fdToString(_fd, _proxy, _addr); + } + catch(const Ice::Exception&) + { + closeSocketNoThrow(_fd); + throw; + } } StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, SOCKET fd) : @@ -48,7 +56,15 @@ StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, SOCKET fd) : #endif { init(); - _desc = fdToString(fd); + try + { + _desc = fdToString(fd); + } + catch(const Ice::Exception&) + { + closeSocketNoThrow(fd); + throw; + } } StreamSocket::~StreamSocket() diff --git a/cpp/src/Ice/WSConnector.h b/cpp/src/Ice/WSConnector.h index 17c002a8db0..3c26a06ab45 100644 --- a/cpp/src/Ice/WSConnector.h +++ b/cpp/src/Ice/WSConnector.h @@ -33,12 +33,12 @@ public: virtual bool operator!=(const Connector&) const; virtual bool operator<(const Connector&) const; -private: WSConnector(const ProtocolInstancePtr&, const ConnectorPtr&, const std::string&, int, const std::string&); virtual ~WSConnector(); - friend class WSEndpoint; +private: + const ProtocolInstancePtr _instance; const ConnectorPtr _delegate; const std::string _host; diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index 31f176bd46f..e7b4a7fac99 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -670,6 +670,11 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, // // Invoke the factory function. // +#ifdef __IBMCPP__ + // xlC warns when casting a void* to function pointer +# pragma report(disable, "1540-0216") +#endif + SERVICE_FACTORY factory = reinterpret_cast<SERVICE_FACTORY>(sym); try { diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index 3127ed47f83..b9aafc93d7b 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -37,7 +37,7 @@ #endif #endif -#if defined(__linux) || defined(__sun) +#if defined(__linux) || defined(__sun) || defined(_AIX) # include <grp.h> // for initgroups #endif diff --git a/cpp/src/IceGridLib/PluginFacadeI.cpp b/cpp/src/IceGridLib/PluginFacadeI.cpp index 6bcd4f92358..0b1748a852b 100644 --- a/cpp/src/IceGridLib/PluginFacadeI.cpp +++ b/cpp/src/IceGridLib/PluginFacadeI.cpp @@ -18,7 +18,7 @@ using namespace IceGrid; namespace { -RegistryPluginFacadePtr pluginFacade; +RegistryPluginFacade* pluginFacade = 0; }; @@ -38,5 +38,13 @@ IceGrid::getRegistryPluginFacade() void IceGrid::setRegistryPluginFacade(const RegistryPluginFacadePtr& facade) { - pluginFacade = facade; + if(pluginFacade) + { + pluginFacade->__decRef(); + } + pluginFacade = facade.get(); + if(pluginFacade) + { + pluginFacade->__incRef(); + } } diff --git a/cpp/src/Slice/Python.cpp b/cpp/src/Slice/Python.cpp index 09a17a93b4a..4343456efb2 100644 --- a/cpp/src/Slice/Python.cpp +++ b/cpp/src/Slice/Python.cpp @@ -665,6 +665,10 @@ Slice::Python::compile(int argc, char* argv[]) } FileTracker::instance()->addFile(file); + // + // Python magic comment to set the file encoding, it must be first or second line + // + out << "# -*- coding: utf-8 -*-\n"; printHeader(out); printGeneratedHeader(out, base + ".ice", "#"); // diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 699bd08ef97..eb637229825 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -518,17 +518,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) // ClassList allBases = p->allBases(); StringList ids; -#if defined(__IBMCPP__) && defined(NDEBUG) -// -// VisualAge C++ 6.0 does not see that ClassDef is a Contained, -// when inlining is on. The code below issues a warning: better -// than an error! -// - transform(allBases.begin(), allBases.end(), back_inserter(ids), - IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped)); -#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp index 97f82811dcf..d262e416f05 100644 --- a/cpp/src/Slice/RubyUtil.cpp +++ b/cpp/src/Slice/RubyUtil.cpp @@ -245,17 +245,7 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) // ClassList allBases = p->allBases(); StringList ids; -#if defined(__IBMCPP__) && defined(NDEBUG) -// -// VisualAge C++ 6.0 does not see that ClassDef is a Contained, -// when inlining is on. The code below issues a warning: better -// than an error! -// - transform(allBases.begin(), allBases.end(), back_inserter(ids), - IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped)); -#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 0203ff1f965..ff29afac5d8 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2726,16 +2726,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; -#if defined(__IBMCPP__) && defined(NDEBUG) -// -// VisualAge C++ 6.0 does not see that ClassDef is a Contained, -// when inlining is on. The code below issues a warning: better -// than an error! -// - transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); -#endif StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); @@ -2849,16 +2840,9 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) if(!allOps.empty()) { StringList allOpNames; -#if defined(__IBMCPP__) && defined(NDEBUG) -// -// See comment for transform above -// - transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), - ::IceUtil::constMemFun<string,Operation>(&Contained::name)); -#else transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); -#endif + allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 98f7ccd3be6..29f89889873 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -415,18 +415,7 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) StringList ids; ClassList bases = p->bases(); bool hasBaseClass = !bases.empty() && !bases.front()->isInterface(); - -#if defined(__IBMCPP__) && defined(NDEBUG) - // - // VisualAge C++ 6.0 does not see that ClassDef is a Contained, - // when inlining is on. The code below issues a warning: better - // than an error! - // - transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped)); -#endif - StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); @@ -831,14 +820,7 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) if(!allOps.empty() || (!p->isInterface() && !hasBaseClass)) { StringList allOpNames; -#if defined(__IBMCPP__) && defined(NDEBUG) - // - // See comment for transform above - // - transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), constMemFun<string,Operation>(&Contained::name)); -#else transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), constMemFun(&Contained::name)); -#endif allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -5428,16 +5410,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) string scoped = p->scoped(); ClassList allBases = p->allBases(); StringList ids; -#if defined(__IBMCPP__) && defined(NDEBUG) - // - // VisualAge C++ 6.0 does not see that ClassDef is a Contained, - // when inlining is on. The code below issues a warning: better - // than an error! - // - transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); -#endif StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); diff --git a/cpp/src/slice2js/Gen.cpp b/cpp/src/slice2js/Gen.cpp index 573d0180c67..9e55b8b65f2 100644 --- a/cpp/src/slice2js/Gen.cpp +++ b/cpp/src/slice2js/Gen.cpp @@ -1294,17 +1294,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) _out << ", undefined"; } -#if defined(__IBMCPP__) && defined(NDEBUG) - // - // VisualAge C++ 6.0 does not see that ClassDef is a Contained, - // when inlining is on. The code below issues a warning: better - // than an error! - // - transform(allBases.begin(), allBases.end(), back_inserter(ids), - ::IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); -#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp index 1cdde0cbce3..0caeaf6704c 100644 --- a/cpp/test/Ice/optional/AllTests.cpp +++ b/cpp/test/Ice/optional/AllTests.cpp @@ -663,6 +663,16 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) test(20 == r->gg2Opt.get()->a); test("gg1" == r->gg1->a); + initial->opVoid(); + + out = Ice::createOutputStream(communicator); + out->startEncapsulation(); + out->write(1, IceUtil::Optional<int>(15)); + out->write(2, IceUtil::Optional<string>("test")); + out->endEncapsulation(); + out->finished(inEncaps); + test(initial->ice_invoke("opVoid", Ice::Normal, inEncaps, outEncaps)); + cout << "ok" << endl; cout << "testing marshalling of large containers with fixed size elements..." << flush; diff --git a/cpp/test/Ice/optional/Test.ice b/cpp/test/Ice/optional/Test.ice index 77a0c41665e..87061a2f317 100644 --- a/cpp/test/Ice/optional/Test.ice +++ b/cpp/test/Ice/optional/Test.ice @@ -232,7 +232,7 @@ class Initial optional(1) string opString(optional(2) string p1, out optional(3) string p3); ["cpp:view-type:Util::string_view"] optional(1) string - opCustomString(["cpp:view-type:Util::string_view"] optional(2) string p1, + opCustomString(["cpp:view-type:Util::string_view"] optional(2) string p1, out ["cpp:view-type:Util::string_view"] optional(3) string p3); optional(1) MyEnum opMyEnum(optional(2) MyEnum p1, out optional(3) MyEnum p3); @@ -303,9 +303,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/cpp/test/Ice/optional/TestAMD.ice b/cpp/test/Ice/optional/TestAMD.ice index ed96f12362c..bac3d41df7f 100644 --- a/cpp/test/Ice/optional/TestAMD.ice +++ b/cpp/test/Ice/optional/TestAMD.ice @@ -233,7 +233,7 @@ class Initial optional(1) string opString(optional(2) string p1, out optional(3) string p3); ["cpp:view-type:Util::string_view"] optional(1) string - opCustomString(["cpp:view-type:Util::string_view"] optional(2) string p1, + opCustomString(["cpp:view-type:Util::string_view"] optional(2) string p1, out ["cpp:view-type:Util::string_view"] optional(3) string p3); optional(1) MyEnum opMyEnum(optional(2) MyEnum p1, out optional(3) MyEnum p3); @@ -304,9 +304,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/cpp/test/Ice/optional/TestAMDI.cpp b/cpp/test/Ice/optional/TestAMDI.cpp index 86959335d4e..fea753dfbdd 100644 --- a/cpp/test/Ice/optional/TestAMDI.cpp +++ b/cpp/test/Ice/optional/TestAMDI.cpp @@ -385,6 +385,13 @@ InitialI::opG_async(const ::Test::AMD_Initial_opGPtr& cb, } void +InitialI::opVoid_async(const ::Test::AMD_Initial_opVoidPtr& cb, + const Ice::Current&) +{ + cb->ice_response(); +} + +void InitialI::supportsRequiredParams_async(const ::Test::AMD_Initial_supportsRequiredParamsPtr& cb, const Ice::Current&) { diff --git a/cpp/test/Ice/optional/TestAMDI.h b/cpp/test/Ice/optional/TestAMDI.h index 4b34ba72b7e..83c12fe1f08 100644 --- a/cpp/test/Ice/optional/TestAMDI.h +++ b/cpp/test/Ice/optional/TestAMDI.h @@ -190,11 +190,14 @@ public: virtual void returnOptionalClass_async(const ::Test::AMD_Initial_returnOptionalClassPtr&, bool, const Ice::Current&); - + virtual void opG_async(const ::Test::AMD_Initial_opGPtr&, const ::Test::GPtr&, const Ice::Current&); + virtual void opVoid_async(const ::Test::AMD_Initial_opVoidPtr&, + const Ice::Current&); + virtual void supportsRequiredParams_async(const ::Test::AMD_Initial_supportsRequiredParamsPtr&, const Ice::Current&); diff --git a/cpp/test/Ice/optional/TestI.cpp b/cpp/test/Ice/optional/TestI.cpp index c3018841afd..bbf68c7bfc2 100644 --- a/cpp/test/Ice/optional/TestI.cpp +++ b/cpp/test/Ice/optional/TestI.cpp @@ -389,6 +389,11 @@ InitialI::opG(const GPtr& g, const Ice::Current&) return g; } +void +InitialI::opVoid(const Ice::Current&) +{ +} + bool InitialI::supportsRequiredParams(const Ice::Current&) { diff --git a/cpp/test/Ice/optional/TestI.h b/cpp/test/Ice/optional/TestI.h index 07a0b01d3cd..f9e77621e25 100644 --- a/cpp/test/Ice/optional/TestI.h +++ b/cpp/test/Ice/optional/TestI.h @@ -184,9 +184,11 @@ public: virtual void sendOptionalClass(bool, const IceUtil::Optional<Test::OneOptionalPtr>&, const Ice::Current&); virtual void returnOptionalClass(bool, IceUtil::Optional<Test::OneOptionalPtr>&, const Ice::Current&); - + virtual ::Test::GPtr opG(const ::Test::GPtr& g, const Ice::Current&); + virtual void opVoid(const Ice::Current&); + virtual bool supportsRequiredParams(const Ice::Current&); virtual bool supportsJavaSerializable(const Ice::Current&); diff --git a/cpp/test/Ice/properties/run.py b/cpp/test/Ice/properties/run.py index a7513acf4f5..c77d767545b 100755 --- a/cpp/test/Ice/properties/run.py +++ b/cpp/test/Ice/properties/run.py @@ -9,7 +9,7 @@ # # ********************************************************************** -import os, sys +import os, sys, locale path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -23,6 +23,13 @@ import TestUtil client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) +if TestUtil.isAIX(): + encoding = locale.getdefaultlocale()[1] + if encoding != "UTF-8": + print("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8") + print("Skipping test") + sys.exit(0) + # # Write config # diff --git a/cpp/test/Ice/stringConverter/Client.cpp b/cpp/test/Ice/stringConverter/Client.cpp index 401570a2a89..a4626b615e4 100644 --- a/cpp/test/Ice/stringConverter/Client.cpp +++ b/cpp/test/Ice/stringConverter/Client.cpp @@ -61,6 +61,28 @@ main(int argc, char* argv[]) IceUtil::setProcessStringConverter(new IceUtil::IconvStringConverter<char>("iso815")); } IceUtil::setProcessWstringConverter(new IceUtil::IconvStringConverter<wchar_t>("ucs4")); + +#elif defined(_AIX) + + // Always big-endian + + if(useLocale) + { + IceUtil::setProcessStringConverter(new IceUtil::IconvStringConverter<char>()); + } + else + { + IceUtil::setProcessStringConverter(new IceUtil::IconvStringConverter<char>("ISO8859-15")); + } + + if(sizeof(wchar_t) == 4) + { + IceUtil::setProcessWstringConverter(new IceUtil::IconvStringConverter<wchar_t>("UTF-32")); + } + else + { + IceUtil::setProcessWstringConverter(new IceUtil::IconvStringConverter<wchar_t>("UTF-16")); + } #else if(useLocale) diff --git a/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp b/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp index 9fcc117d627..6172e9e689e 100644 --- a/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp +++ b/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp @@ -52,8 +52,11 @@ public: { test(_facade->getApplicationInfo(_facade->getAdapterApplication(*p)).descriptor.name == "Test"); test(_facade->getServerInfo(_facade->getAdapterServer(*p)).application == "Test"); - test(_facade->getNodeInfo(_facade->getAdapterNode(*p)).name == "localnode"); + test(_facade->getNodeInfo(_facade->getAdapterNode(*p)).name == "localnode"); +#ifndef _AIX + // On AIX, icegridnode needs read permissions on /dev/kmem test(_facade->getNodeLoad(_facade->getAdapterNode(*p)).avg1 >= 0.0); +#endif test(_facade->getAdapterInfo(*p)[0].replicaGroupId == id); test(_facade->getPropertyForAdapter(*p, "Identity") == id); } diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp index 3fc92e581f1..3313424859a 100644 --- a/cpp/test/IceSSL/configuration/AllTests.cpp +++ b/cpp/test/IceSSL/configuration/AllTests.cpp @@ -2046,9 +2046,9 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12, b #endif // - // No DSA support in Secure Transport. + // No DSA support in Secure Transport / AIX 7.1 // -#ifndef ICE_USE_SECURE_TRANSPORT +#if !defined(ICE_USE_SECURE_TRANSPORT) && !defined(_AIX) { // @@ -3214,6 +3214,9 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12, b #endif } +#ifndef _AIX + // On AIX 6.1, the default root certificates don't validate demo.zeroc.com + cout << "testing system CAs... " << flush; { InitializationData initData; @@ -3257,6 +3260,7 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12, b comm->destroy(); } cout << "ok" << endl; +#endif if(shutdown) { diff --git a/cpp/test/IceSSL/configuration/run.py b/cpp/test/IceSSL/configuration/run.py index 07e001c4fdc..fea76d43f3f 100755 --- a/cpp/test/IceSSL/configuration/run.py +++ b/cpp/test/IceSSL/configuration/run.py @@ -43,7 +43,7 @@ if TestUtil.isDarwin(): os.system("security create-keychain -p password %s" % keychainPath) for cert in ["s_rsa_ca1.p12", "c_rsa_ca1.p12"]: os.system("security import %s -f pkcs12 -A -P password -k %s" % (os.path.join(certsPath, cert), keychainPath)) -elif TestUtil.isLinux(): +elif TestUtil.isLinux() or TestUtil.isAIX(): # # Create copies of the CA certificates named after the subject # hash. This is used by the tests to find the CA certificates in diff --git a/cpp/test/Slice/headers/run.py b/cpp/test/Slice/headers/run.py index cd2633927ad..53f4982b0e4 100755 --- a/cpp/test/Slice/headers/run.py +++ b/cpp/test/Slice/headers/run.py @@ -37,6 +37,7 @@ os.symlink("a3.ice", os.path.join("slices", "dir1", "linktoa3.ice")) os.symlink("dir2", os.path.join("slices", "linktodir2")) slice2cpp = TestUtil.getSliceTranslator() +TestUtil.addLdPath(TestUtil.getCppLibDir()) basedir = os.path.dirname(os.path.abspath(__file__)) slicedir = TestUtil.getSliceDir() diff --git a/csharp/src/Ice/ConnectionFactory.cs b/csharp/src/Ice/ConnectionFactory.cs index 19ebfbad9e6..d51c4fe06f2 100644 --- a/csharp/src/Ice/ConnectionFactory.cs +++ b/csharp/src/Ice/ConnectionFactory.cs @@ -848,24 +848,10 @@ namespace IceInternal public void connectionStartFailed(Ice.ConnectionI connection, Ice.LocalException ex) { - if(_observer != null) - { - _observer.failed(ex.ice_id()); - _observer.detach(); - } - _factory.handleConnectionException(ex, _hasMore || _iter < _connectors.Count); - if(ex is Ice.CommunicatorDestroyedException) // No need to continue. - { - _factory.finishGetConnection(_connectors, ex, this); - } - else if(_iter < _connectors.Count) // Try the next connector. + if(connectionStartFailedImpl(ex)) { nextConnector(); } - else - { - _factory.finishGetConnection(_connectors, ex, this); - } } // @@ -1023,52 +1009,81 @@ namespace IceInternal internal void nextConnector() { - Ice.ConnectionI connection = null; - try + while(true) { - Debug.Assert(_iter < _connectors.Count); - _current = _connectors[_iter++]; - - Ice.Instrumentation.CommunicatorObserver obsv = _factory._instance.initializationData().observer; - if(obsv != null) + try { - _observer = obsv.getConnectionEstablishmentObserver(_current.endpoint, - _current.connector.ToString()); - if(_observer != null) + Debug.Assert(_iter < _connectors.Count); + _current = _connectors[_iter++]; + + Ice.Instrumentation.CommunicatorObserver obsv = _factory._instance.initializationData().observer; + if(obsv != null) { - _observer.attach(); + _observer = obsv.getConnectionEstablishmentObserver(_current.endpoint, + _current.connector.ToString()); + if(_observer != null) + { + _observer.attach(); + } + } + + if(_factory._instance.traceLevels().network >= 2) + { + StringBuilder s = new StringBuilder("trying to establish "); + s.Append(_current.endpoint.protocol()); + s.Append(" connection to "); + s.Append(_current.connector.ToString()); + _factory._instance.initializationData().logger.trace( + _factory._instance.traceLevels().networkCat, s.ToString()); } - } - if(_factory._instance.traceLevels().network >= 2) + Ice.ConnectionI connection = _factory.createConnection(_current.connector.connect(), _current); + connection.start(this); + } + catch(Ice.LocalException ex) { - StringBuilder s = new StringBuilder("trying to establish "); - s.Append(_current.endpoint.protocol()); - s.Append(" connection to "); - s.Append(_current.connector.ToString()); - _factory._instance.initializationData().logger.trace( - _factory._instance.traceLevels().networkCat, s.ToString()); + if(_factory._instance.traceLevels().network >= 2) + { + StringBuilder s = new StringBuilder("failed to establish "); + s.Append(_current.endpoint.protocol()); + s.Append(" connection to "); + s.Append(_current.connector.ToString()); + s.Append("\n"); + s.Append(ex); + _factory._instance.initializationData().logger.trace( + _factory._instance.traceLevels().networkCat, s.ToString()); + } + + if(connectionStartFailedImpl(ex)) + { + continue; + } } + break; + } + } - connection = _factory.createConnection(_current.connector.connect(), _current); - connection.start(this); + private bool connectionStartFailedImpl(Ice.LocalException ex) + { + if(_observer != null) + { + _observer.failed(ex.ice_name()); + _observer.detach(); } - catch(Ice.LocalException ex) + _factory.handleConnectionException(ex, _hasMore || _iter < _connectors.Count); + if(ex is Ice.CommunicatorDestroyedException) // No need to continue. { - if(_factory._instance.traceLevels().network >= 2) - { - StringBuilder s = new StringBuilder("failed to establish "); - s.Append(_current.endpoint.protocol()); - s.Append(" connection to "); - s.Append(_current.connector.ToString()); - s.Append("\n"); - s.Append(ex); - _factory._instance.initializationData().logger.trace( - _factory._instance.traceLevels().networkCat, s.ToString()); - } - - connectionStartFailed(connection, ex); + _factory.finishGetConnection(_connectors, ex, this); } + else if(_iter < _connectors.Count) // Try the next connector. + { + return true; + } + else + { + _factory.finishGetConnection(_connectors, ex, this); + } + return false; } private OutgoingConnectionFactory _factory; diff --git a/csharp/src/Ice/StreamSocket.cs b/csharp/src/Ice/StreamSocket.cs index 6cebaff9662..6801484906d 100644 --- a/csharp/src/Ice/StreamSocket.cs +++ b/csharp/src/Ice/StreamSocket.cs @@ -41,7 +41,15 @@ namespace IceInternal _instance = instance; _fd = fd; _state = StateConnected; - _desc = IceInternal.Network.fdToString(_fd); + try + { + _desc = IceInternal.Network.fdToString(_fd); + } + catch(Exception ex) + { + Network.closeSocketNoThrow(_fd); + throw ex; + } init(); } @@ -394,11 +402,7 @@ namespace IceInternal Debug.Assert(_fd != null); try { - _fd.Close(); - } - catch(SocketException ex) - { - throw new Ice.SocketException(ex); + Network.closeSocket(_fd); } finally { diff --git a/csharp/test/Ice/optional/AllTests.cs b/csharp/test/Ice/optional/AllTests.cs index e24e35329b3..aaedca479e9 100644 --- a/csharp/test/Ice/optional/AllTests.cs +++ b/csharp/test/Ice/optional/AllTests.cs @@ -445,6 +445,18 @@ public class AllTests : TestCommon.TestApp test(20 == g.gg2Opt.Value.a); test("gg1".Equals(g.gg1.a)); + initial.opVoid(); + + os = new Ice.OutputStream(communicator); + os.startEncapsulation(); + os.writeOptional(1, Ice.OptionalFormat.F4); + os.writeInt(15); + os.writeOptional(1, Ice.OptionalFormat.VSize); + os.writeString("test"); + os.endEncapsulation(); + inEncaps = os.finished(); + test(initial.ice_invoke("opVoid", Ice.OperationMode.Normal, inEncaps, out outEncaps)); + WriteLine("ok"); Write("testing marshaling of large containers with fixed size elements... "); diff --git a/csharp/test/Ice/optional/Test.ice b/csharp/test/Ice/optional/Test.ice index d4db71c76e1..99d1bc7558f 100644 --- a/csharp/test/Ice/optional/Test.ice +++ b/csharp/test/Ice/optional/Test.ice @@ -282,9 +282,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/csharp/test/Ice/optional/TestAMD.ice b/csharp/test/Ice/optional/TestAMD.ice index a2d50d70352..e8e4fab4cb7 100644 --- a/csharp/test/Ice/optional/TestAMD.ice +++ b/csharp/test/Ice/optional/TestAMD.ice @@ -282,9 +282,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/csharp/test/Ice/optional/TestAMDI.cs b/csharp/test/Ice/optional/TestAMDI.cs index 66aab304e71..05475175e1e 100644 --- a/csharp/test/Ice/optional/TestAMDI.cs +++ b/csharp/test/Ice/optional/TestAMDI.cs @@ -254,12 +254,17 @@ public class InitialI : Test.Initial { cb.ice_response(new Test.OneOptional(53)); } - + public override void opG_async(Test.AMD_Initial_opG cb, Test.G g, Ice.Current current) { cb.ice_response(g); } + public override void opVoid_async(Test.AMD_Initial_opVoid cb, Ice.Current current) + { + cb.ice_response(); + } + public override void supportsRequiredParams_async(Test.AMD_Initial_supportsRequiredParams cb, Ice.Current current) { cb.ice_response(false); diff --git a/csharp/test/Ice/optional/TestI.cs b/csharp/test/Ice/optional/TestI.cs index 10a2a08109a..13b3d59e8e1 100644 --- a/csharp/test/Ice/optional/TestI.cs +++ b/csharp/test/Ice/optional/TestI.cs @@ -291,12 +291,16 @@ public class InitialI : Test.Initial { o = new Test.OneOptional(53); } - + public override Test.G opG(Test.G g, Ice.Current current) { return g; } + public override void opVoid(Ice.Current current) + { + } + public override bool supportsRequiredParams(Ice.Current current) { return false; diff --git a/java/src/Ice/src/main/java/IceInternal/Incoming.java b/java/src/Ice/src/main/java/IceInternal/Incoming.java index 478e38e5293..25efbbba30e 100644 --- a/java/src/Ice/src/main/java/IceInternal/Incoming.java +++ b/java/src/Ice/src/main/java/IceInternal/Incoming.java @@ -383,8 +383,7 @@ final public class Incoming extends IncomingBase implements Ice.Request public final void readEmptyParams() { - _current.encoding = new Ice.EncodingVersion(); - _is.skipEmptyEncapsulation(_current.encoding); + _current.encoding = _is.skipEmptyEncapsulation(); } public final byte[] diff --git a/java/src/Ice/src/main/java/IceInternal/OutgoingAsync.java b/java/src/Ice/src/main/java/IceInternal/OutgoingAsync.java index b50bd994ca0..bb115cf3686 100644 --- a/java/src/Ice/src/main/java/IceInternal/OutgoingAsync.java +++ b/java/src/Ice/src/main/java/IceInternal/OutgoingAsync.java @@ -382,7 +382,7 @@ public class OutgoingAsync extends ProxyOutgoingAsyncBase public void readEmptyParams() { - _is.skipEmptyEncapsulation(null); + _is.skipEmptyEncapsulation(); } public byte[] readParamEncaps() diff --git a/java/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java b/java/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java index 94da96129f6..94b80c0e2fb 100644 --- a/java/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java +++ b/java/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java @@ -871,26 +871,10 @@ public final class OutgoingConnectionFactory connectionStartFailed(Ice.ConnectionI connection, Ice.LocalException ex) { assert(_current != null); - - if(_observer != null) - { - _observer.failed(ex.ice_id()); - _observer.detach(); - } - - _factory.handleConnectionException(ex, _hasMore || _iter.hasNext()); - if(ex instanceof Ice.CommunicatorDestroyedException) // No need to continue. - { - _factory.finishGetConnection(_connectors, ex, this); - } - else if(_iter.hasNext()) // Try the next connector. + if(connectionStartFailedImpl(ex)) { nextConnector(); } - else - { - _factory.finishGetConnection(_connectors, ex, this); - } } // @@ -1059,52 +1043,83 @@ public final class OutgoingConnectionFactory private void nextConnector() { - Ice.ConnectionI connection = null; - try + while(true) { - assert(_iter.hasNext()); - _current = _iter.next(); - - Ice.Instrumentation.CommunicatorObserver obsv = _factory._instance.initializationData().observer; - if(obsv != null) + try { - _observer = obsv.getConnectionEstablishmentObserver(_current.endpoint, - _current.connector.toString()); - if(_observer != null) + assert(_iter.hasNext()); + _current = _iter.next(); + + Ice.Instrumentation.CommunicatorObserver obsv = _factory._instance.initializationData().observer; + if(obsv != null) { - _observer.attach(); + _observer = obsv.getConnectionEstablishmentObserver(_current.endpoint, + _current.connector.toString()); + if(_observer != null) + { + _observer.attach(); + } } - } - if(_factory._instance.traceLevels().network >= 2) - { - StringBuffer s = new StringBuffer("trying to establish "); - s.append(_current.endpoint.protocol()); - s.append(" connection to "); - s.append(_current.connector.toString()); - _factory._instance.initializationData().logger.trace(_factory._instance.traceLevels().networkCat, - s.toString()); + if(_factory._instance.traceLevels().network >= 2) + { + StringBuffer s = new StringBuffer("trying to establish "); + s.append(_current.endpoint.protocol()); + s.append(" connection to "); + s.append(_current.connector.toString()); + _factory._instance.initializationData().logger.trace(_factory._instance.traceLevels().networkCat, + s.toString()); + } + + Ice.ConnectionI connection = _factory.createConnection(_current.connector.connect(), _current); + connection.start(this); } + catch(Ice.LocalException ex) + { + if(_factory._instance.traceLevels().network >= 2) + { + StringBuffer s = new StringBuffer("failed to establish "); + s.append(_current.endpoint.protocol()); + s.append(" connection to "); + s.append(_current.connector.toString()); + s.append("\n"); + s.append(ex); + _factory._instance.initializationData().logger.trace(_factory._instance.traceLevels().networkCat, + s.toString()); + } - connection = _factory.createConnection(_current.connector.connect(), _current); - connection.start(this); + if(connectionStartFailedImpl(ex)) + { + continue; + } + } + break; } - catch(Ice.LocalException ex) + } + + private boolean + connectionStartFailedImpl(Ice.LocalException ex) + { + if(_observer != null) { - if(_factory._instance.traceLevels().network >= 2) - { - StringBuffer s = new StringBuffer("failed to establish "); - s.append(_current.endpoint.protocol()); - s.append(" connection to "); - s.append(_current.connector.toString()); - s.append("\n"); - s.append(ex); - _factory._instance.initializationData().logger.trace(_factory._instance.traceLevels().networkCat, - s.toString()); - } + _observer.failed(ex.ice_id()); + _observer.detach(); + } - connectionStartFailed(connection, ex); + _factory.handleConnectionException(ex, _hasMore || _iter.hasNext()); + if(ex instanceof Ice.CommunicatorDestroyedException) // No need to continue. + { + _factory.finishGetConnection(_connectors, ex, this); + } + else if(_iter.hasNext()) // Try the next connector. + { + return true; + } + else + { + _factory.finishGetConnection(_connectors, ex, this); } + return false; } private final OutgoingConnectionFactory _factory; diff --git a/java/src/Ice/src/main/java/IceInternal/StreamSocket.java b/java/src/Ice/src/main/java/IceInternal/StreamSocket.java index c628d791d71..03cd265e0e6 100644 --- a/java/src/Ice/src/main/java/IceInternal/StreamSocket.java +++ b/java/src/Ice/src/main/java/IceInternal/StreamSocket.java @@ -27,7 +27,7 @@ public class StreamSocket init(); if(Network.doConnect(_fd, _proxy != null ? _proxy.getAddress() : _addr, sourceAddr)) { - _state = StateConnected; + _state = _proxy != null ? StateProxyWrite : StateConnected; } } catch(Ice.LocalException ex) diff --git a/java/test/src/main/java/test/Ice/optional/AMDInitialI.java b/java/test/src/main/java/test/Ice/optional/AMDInitialI.java index 0d132abe559..b7feeebbd80 100644 --- a/java/test/src/main/java/test/Ice/optional/AMDInitialI.java +++ b/java/test/src/main/java/test/Ice/optional/AMDInitialI.java @@ -564,7 +564,7 @@ public final class AMDInitialI extends Initial { cb.ice_response(new Ice.Optional<OneOptional>(new OneOptional(53))); } - + @Override public void opG_async(AMD_Initial_opG cb, G g, Ice.Current current) @@ -574,6 +574,13 @@ public final class AMDInitialI extends Initial @Override public void + opVoid_async(AMD_Initial_opVoid cb, Ice.Current current) + { + cb.ice_response(); + } + + @Override + public void supportsRequiredParams_async(AMD_Initial_supportsRequiredParams cb, Ice.Current current) { cb.ice_response(true); diff --git a/java/test/src/main/java/test/Ice/optional/AllTests.java b/java/test/src/main/java/test/Ice/optional/AllTests.java index 495e5de8ded..095b8d78055 100644 --- a/java/test/src/main/java/test/Ice/optional/AllTests.java +++ b/java/test/src/main/java/test/Ice/optional/AllTests.java @@ -416,6 +416,18 @@ public class AllTests test(20 == g.getGg2Opt().a); test("gg1".equals(g.gg1.a)); + initial.opVoid(); + + os = new Ice.OutputStream(communicator); + os.startEncapsulation(); + os.writeOptional(1, Ice.OptionalFormat.F4); + os.writeInt(15); + os.writeOptional(1, Ice.OptionalFormat.VSize); + os.writeString("test"); + os.endEncapsulation(); + inEncaps = os.finished(); + test(initial.ice_invoke("opVoid", Ice.OperationMode.Normal, inEncaps, outEncaps)); + out.println("ok"); out.print("testing marshaling of large containers with fixed size elements... "); diff --git a/java/test/src/main/java/test/Ice/optional/InitialI.java b/java/test/src/main/java/test/Ice/optional/InitialI.java index f581047ac5a..54eda7d7f73 100644 --- a/java/test/src/main/java/test/Ice/optional/InitialI.java +++ b/java/test/src/main/java/test/Ice/optional/InitialI.java @@ -612,7 +612,7 @@ public final class InitialI extends Initial { o.set(new OneOptional(53)); } - + @Override public G opG(G g, Ice.Current current) @@ -621,6 +621,12 @@ public final class InitialI extends Initial } @Override + public void + opVoid(Ice.Current current) + { + } + + @Override public boolean supportsRequiredParams(Ice.Current current) { diff --git a/java/test/src/main/java/test/Ice/optional/Test.ice b/java/test/src/main/java/test/Ice/optional/Test.ice index 9ea0d9b4028..7fbce8c3270 100644 --- a/java/test/src/main/java/test/Ice/optional/Test.ice +++ b/java/test/src/main/java/test/Ice/optional/Test.ice @@ -318,9 +318,11 @@ class Initial ["java:optional"] void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/java/test/src/main/java/test/Ice/optional/TestAMD.ice b/java/test/src/main/java/test/Ice/optional/TestAMD.ice index 42af1f17928..e318e105e39 100644 --- a/java/test/src/main/java/test/Ice/optional/TestAMD.ice +++ b/java/test/src/main/java/test/Ice/optional/TestAMD.ice @@ -319,9 +319,11 @@ class Initial ["java:optional"] void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/js/src/Ice/AsyncResult.js b/js/src/Ice/AsyncResult.js index 55545393cb7..226148eb00d 100644 --- a/js/src/Ice/AsyncResult.js +++ b/js/src/Ice/AsyncResult.js @@ -38,7 +38,7 @@ var AsyncResult = Ice.Class(AsyncResultBase, { { return; } - + this._completed = completedFn; this._is = null; this._os = com !== null ? new OutputStream(this._instance, Protocol.currentProtocolEncoding) : null; @@ -148,7 +148,7 @@ var AsyncResult = Ice.Class(AsyncResultBase, { }, __readEmptyParams: function() { - this._is.skipEmptyEncapsulation(null); + this._is.skipEmptyEncapsulation(); }, __readParamEncaps: function() { diff --git a/js/src/Ice/IncomingAsync.js b/js/src/Ice/IncomingAsync.js index fe54c782876..1601419278c 100644 --- a/js/src/Ice/IncomingAsync.js +++ b/js/src/Ice/IncomingAsync.js @@ -577,8 +577,7 @@ var IncomingAsync = Ice.Class({ }, readEmptyParams: function() { - this._current.encoding = new Ice.EncodingVersion(); - this._is.skipEmptyEncapsulation(this._current.encoding); + this._current.encoding = this._is.skipEmptyEncapsulation(); }, readParamEncaps: function() { diff --git a/js/src/Ice/OutgoingAsync.js b/js/src/Ice/OutgoingAsync.js index 452f2d1210d..50cbbc6706e 100644 --- a/js/src/Ice/OutgoingAsync.js +++ b/js/src/Ice/OutgoingAsync.js @@ -492,7 +492,7 @@ var OutgoingAsync = Ice.Class(ProxyOutgoingAsyncBase, { }, __readEmptyParams: function() { - this._is.skipEmptyEncapsulation(null); + this._is.skipEmptyEncapsulation(); }, __readParamEncaps: function() { diff --git a/js/src/Ice/OutgoingConnectionFactory.js b/js/src/Ice/OutgoingConnectionFactory.js index d2c88846249..12fec6c67e5 100644 --- a/js/src/Ice/OutgoingConnectionFactory.js +++ b/js/src/Ice/OutgoingConnectionFactory.js @@ -807,26 +807,9 @@ var ConnectCallback = Class({ connectionStartFailed: function(connection, ex) { Debug.assert(this._current !== null); - - if(ex instanceof Ice.LocalException) - { - this._factory.handleConnectionException(ex, this._hasMore || this._index < this._endpoints.length); - if(ex instanceof Ice.CommunicatorDestroyedException) // No need to continue. - { - this._factory.finishGetConnectionEx(this._endpoints, ex, this); - } - else if(this._index < this._endpoints.length) // Try the next endpoint. - { - this.nextEndpoint(); - } - else - { - this._factory.finishGetConnectionEx(this._endpoints, ex, this); - } - } - else + if(this.connectionStartFailedImpl(ex)) { - this._factory.finishGetConnectionEx(this._endpoints, ex, this); + this.nextEndpoint(); } }, setConnection: function(connection, compress) @@ -929,50 +912,80 @@ var ConnectCallback = Class({ }, nextEndpoint: function() { - var connection = null; - var traceLevels = this._factory._instance.traceLevels(); - try + while(true) { - Debug.assert(this._index < this._endpoints.length); - this._current = this._endpoints[this._index++]; - - if(traceLevels.network >= 2) + var traceLevels = this._factory._instance.traceLevels(); + try { - var s = []; - s.push("trying to establish "); - s.push(this._current.protocol()); - s.push(" connection to "); - s.push(this._current.toConnectorString()); - this._factory._instance.initializationData().logger.trace(traceLevels.networkCat, s.join("")); - } + Debug.assert(this._index < this._endpoints.length); + this._current = this._endpoints[this._index++]; - connection = this._factory.createConnection(this._current.connect(), this._current); - var self = this; - connection.start().then( - function() + if(traceLevels.network >= 2) { - self.connectionStartCompleted(connection); - }, - function(ex) + var s = []; + s.push("trying to establish "); + s.push(this._current.protocol()); + s.push(" connection to "); + s.push(this._current.toConnectorString()); + this._factory._instance.initializationData().logger.trace(traceLevels.networkCat, s.join("")); + } + + var connection = this._factory.createConnection(this._current.connect(), this._current); + var self = this; + connection.start().then( + function() + { + self.connectionStartCompleted(connection); + }, + function(ex) + { + self.connectionStartFailed(connection, ex); + }); + } + catch(ex) + { + if(traceLevels.network >= 2) + { + var s = []; + s.push("failed to establish "); + s.push(this._current.protocol()); + s.push(" connection to "); + s.push(this._current.toString()); + s.push("\n"); + s.push(ex.toString()); + this._factory._instance.initializationData().logger.trace(traceLevels.networkCat, s.join("")); + } + + if(this.connectionStartFailedImpl(ex)) { - self.connectionStartFailed(connection, ex); - }); + continue; + } + } + break; } - catch(ex) + }, + connectionStartFailedImpl: function(ex) + { + if(ex instanceof Ice.LocalException) { - if(traceLevels.network >= 2) + this._factory.handleConnectionException(ex, this._hasMore || this._index < this._endpoints.length); + if(ex instanceof Ice.CommunicatorDestroyedException) // No need to continue. { - var s = []; - s.push("failed to establish "); - s.push(this._current.protocol()); - s.push(" connection to "); - s.push(this._current.toString()); - s.push("\n"); - s.push(ex.toString()); - this._factory._instance.initializationData().logger.trace(traceLevels.networkCat, s.join("")); + this._factory.finishGetConnectionEx(this._endpoints, ex, this); } - - this.connectionStartFailed(connection, ex); + else if(this._index < this._endpoints.length) // Try the next endpoint. + { + return true; + } + else + { + this._factory.finishGetConnectionEx(this._endpoints, ex, this); + } + } + else + { + this._factory.finishGetConnectionEx(this._endpoints, ex, this); } + return false; } }); diff --git a/js/test/Ice/optional/.gitignore b/js/test/Ice/optional/.gitignore index d158d9308ba..2a186804ea5 100644 --- a/js/test/Ice/optional/.gitignore +++ b/js/test/Ice/optional/.gitignore @@ -1,2 +1,3 @@ Test.js +ClientPrivate.js index.html diff --git a/js/test/Ice/optional/Client.js b/js/test/Ice/optional/Client.js index f28a37e1fe9..02cb3340d76 100644 --- a/js/test/Ice/optional/Client.js +++ b/js/test/Ice/optional/Client.js @@ -11,6 +11,7 @@ { var Ice = require("ice").Ice; var Test = require("Test").Test; + var ClientPrivate = require("../optional/ClientPrivate").Test; var Promise = Ice.Promise; var ArrayUtil = Ice.ArrayUtil; @@ -355,7 +356,16 @@ test(g.gg2.a.equals(new Ice.Long(0, 10))); test(g.gg2Opt.a.equals(new Ice.Long(0, 20))); test(g.gg1.a == "gg1"); - + } + ).then( + function() + { + var init2 = ClientPrivate.Initial2Prx.uncheckedCast(initial) + return init2.opVoid(5, "test"); + } + ).then( + function() + { out.writeLine("ok"); out.write("testing marshaling of large containers with fixed size elements... "); var mc = new Test.MultiOptional(); diff --git a/js/test/Ice/optional/ClientPrivate.ice b/js/test/Ice/optional/ClientPrivate.ice new file mode 100644 index 00000000000..5dd08613b9a --- /dev/null +++ b/js/test/Ice/optional/ClientPrivate.ice @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#pragma once + +#include <Test.ice> + +module Test +{ + +// +// The server doesn't know this class. +// +class D extends B +{ + string ds; + optional(990) StringSeq seq; + optional(1000) A ao; +}; + +// +// This class is a hack that allows us to invoke the opClassAndUnknownOptional operation +// on the server and pass an optional argument. This isn't necessary in other language +// mappings where the public stream API is available. +// +class Initial2 +{ + void opClassAndUnknownOptional(A p, optional(1) Object o); + + void opVoid(optional(1) int a, optional(2) string v); +}; + +}; diff --git a/js/test/Ice/optional/Test.ice b/js/test/Ice/optional/Test.ice index 00d8381fc75..81d6d459690 100644 --- a/js/test/Ice/optional/Test.ice +++ b/js/test/Ice/optional/Test.ice @@ -301,9 +301,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/js/test/Ice/optionalBidir/AMDInitialI.js b/js/test/Ice/optionalBidir/AMDInitialI.js index 74d9070bf98..332b2a562bf 100644 --- a/js/test/Ice/optionalBidir/AMDInitialI.js +++ b/js/test/Ice/optionalBidir/AMDInitialI.js @@ -359,6 +359,10 @@ { cb.ice_response(g); }, + opVoid_async: function(cb, current) + { + cb.ice_response(); + }, supportsRequiredParams_async: function(cb, current) { cb.ice_response(false); diff --git a/js/test/Ice/optionalBidir/InitialI.js b/js/test/Ice/optionalBidir/InitialI.js index 3884c32ef58..c50e3125a13 100644 --- a/js/test/Ice/optionalBidir/InitialI.js +++ b/js/test/Ice/optionalBidir/InitialI.js @@ -352,6 +352,9 @@ { return g; }, + opVoid: function() + { + }, returnOptionalClass: function(req, current) { return new Test.OneOptional(53); diff --git a/js/test/Ice/optionalBidir/Test.ice b/js/test/Ice/optionalBidir/Test.ice index 3e84af1c344..babee62c36e 100644 --- a/js/test/Ice/optionalBidir/Test.ice +++ b/js/test/Ice/optionalBidir/Test.ice @@ -301,9 +301,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/js/test/Ice/optionalBidir/TestAMD.ice b/js/test/Ice/optionalBidir/TestAMD.ice index 05dd4d33001..54198e3045b 100644 --- a/js/test/Ice/optionalBidir/TestAMD.ice +++ b/js/test/Ice/optionalBidir/TestAMD.ice @@ -301,9 +301,11 @@ class G void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/objective-c/test/Ice/optional/AllTests.m b/objective-c/test/Ice/optional/AllTests.m index 67b9d0c1463..371602faca1 100644 --- a/objective-c/test/Ice/optional/AllTests.m +++ b/objective-c/test/Ice/optional/AllTests.m @@ -634,6 +634,14 @@ optionalAllTests(id<ICECommunicator> communicator) test(r.gg2.a == 10); test(r.gg2Opt.a == 20); + os = [ICEUtil createOutputStream:communicator]; + [os startEncapsulation]; + [ICEIntHelper writeOpt:@15 stream:os tag:1]; + [ICEStringHelper writeOpt:@"test" stream:os tag:2]; + [os endEncapsulation]; + inEncaps = [os finished]; + test([initial ice_invoke:@"opVoid" mode:ICENormal inEncaps:inEncaps outEncaps:&outEncaps]); + tprintf("ok\n"); tprintf("testing marshalling of large containers with fixed size elements..."); diff --git a/objective-c/test/Ice/optional/OptionalTest.ice b/objective-c/test/Ice/optional/OptionalTest.ice index b8411fde1f5..d1748c5d47b 100644 --- a/objective-c/test/Ice/optional/OptionalTest.ice +++ b/objective-c/test/Ice/optional/OptionalTest.ice @@ -295,7 +295,9 @@ class Initial void returnOptionalClass(bool req, out optional(1) OneOptional o); G opG(G g); - + + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/objective-c/test/Ice/optional/TestI.m b/objective-c/test/Ice/optional/TestI.m index 6cb522c55b7..2a7df650f51 100644 --- a/objective-c/test/Ice/optional/TestI.m +++ b/objective-c/test/Ice/optional/TestI.m @@ -227,6 +227,9 @@ { return g; } +-(void) opVoid:(ICECurrent*)current +{ +} -(BOOL) supportsRequiredParams:(ICECurrent*)current { diff --git a/php/test/Ice/optional/Client.php b/php/test/Ice/optional/Client.php index 85afef6f086..79076dd10ec 100644 --- a/php/test/Ice/optional/Client.php +++ b/php/test/Ice/optional/Client.php @@ -355,6 +355,10 @@ function allTests($communicator) test($r->gg2Opt->a == 20); test($r->gg1->a == "gg1"); + $initial2 = $NS ? eval("return Test\\Initial2PrxHelper::uncheckedCast(\$base);") : + eval("return Test_Initial2PrxHelper::uncheckedCast(\$base);"); + $initial2->opVoid(15, "test"); + echo "ok\n"; echo "testing marshaling of large containers with fixed size elements... "; diff --git a/php/test/Ice/optional/ClientPrivate.ice b/php/test/Ice/optional/ClientPrivate.ice index 9a173d452e1..5dd08613b9a 100644 --- a/php/test/Ice/optional/ClientPrivate.ice +++ b/php/test/Ice/optional/ClientPrivate.ice @@ -32,6 +32,8 @@ class D extends B class Initial2 { void opClassAndUnknownOptional(A p, optional(1) Object o); + + void opVoid(optional(1) int a, optional(2) string v); }; }; diff --git a/python/config/Make.rules.AIX b/python/config/Make.rules.AIX new file mode 100644 index 00000000000..71e616a0384 --- /dev/null +++ b/python/config/Make.rules.AIX @@ -0,0 +1,25 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +# +# This file is itself included by Make.rules +# + +include $(top_srcdir)/../cpp/config/Make.rules.$(UNAME) + +# +# Need .so for Python extension +# +# Note: Python also loads the extension in IcePy.a if IcePy.so points to it +# + +mkpylibfilename = $(1).so +mkylibname = $(1).so + +mkshlib = $(CXX) -qmkshrobj $(LDFLAGS) -o $(1) $(3) $(4) diff --git a/python/modules/IcePy/Slice.cpp b/python/modules/IcePy/Slice.cpp index bf856f8b654..a4692f6465f 100644 --- a/python/modules/IcePy/Slice.cpp +++ b/python/modules/IcePy/Slice.cpp @@ -161,6 +161,10 @@ IcePy_loadSlice(PyObject* /*self*/, PyObject* args) ostringstream codeStream; IceUtilInternal::Output out(codeStream); out.setUseTab(false); + // + // Python magic comment to set the file encoding, it must be first or second line + // + out << "# -*- coding: utf-8 -*-\n"; generate(u, all, checksum, includePaths, out); u->destroy(); diff --git a/python/test/Ice/optional/AllTests.py b/python/test/Ice/optional/AllTests.py index 574727ab386..e2c20f64783 100644 --- a/python/test/Ice/optional/AllTests.py +++ b/python/test/Ice/optional/AllTests.py @@ -324,7 +324,7 @@ def allTests(communicator): outer = Test.Recursive() outer.value = recursive1 initial.pingPong(outer) - + g = Test.G() g.gg1Opt = Test.G1("gg1Opt") g.gg2 = Test.G2(10) @@ -336,6 +336,9 @@ def allTests(communicator): test(r.gg2Opt.a == 20) test(r.gg1.a == "gg1") + initial2 = Test.Initial2Prx.uncheckedCast(base) + initial2.opVoid(15, "test") + print("ok") sys.stdout.write("testing marshaling of large containers with fixed size elements... ") diff --git a/python/test/Ice/optional/ClientPrivate.ice b/python/test/Ice/optional/ClientPrivate.ice index 9a173d452e1..5dd08613b9a 100644 --- a/python/test/Ice/optional/ClientPrivate.ice +++ b/python/test/Ice/optional/ClientPrivate.ice @@ -32,6 +32,8 @@ class D extends B class Initial2 { void opClassAndUnknownOptional(A p, optional(1) Object o); + + void opVoid(optional(1) int a, optional(2) string v); }; }; diff --git a/python/test/Ice/optional/Server.py b/python/test/Ice/optional/Server.py index 928b6c2c1d9..eba7e7ccad6 100755 --- a/python/test/Ice/optional/Server.py +++ b/python/test/Ice/optional/Server.py @@ -137,10 +137,13 @@ class InitialI(Test.Initial): def returnOptionalClass(self, req, current=None): return Test.OneOptional(5) - + def opG(self, g, current=None): return g + def opVoid(self, current=None): + pass + def supportsRequiredParams(self, current=None): return False diff --git a/python/test/Ice/optional/ServerAMD.py b/python/test/Ice/optional/ServerAMD.py index fb00aa09330..97ae0ce268e 100755 --- a/python/test/Ice/optional/ServerAMD.py +++ b/python/test/Ice/optional/ServerAMD.py @@ -138,10 +138,13 @@ class InitialI(Test.Initial): def returnOptionalClass_async(self, cb, req, current=None): cb.ice_response(Test.OneOptional(5)) - + def opG_async(self, cb, g, current=None): cb.ice_response(g) + def opVoid_async(self, cb, current=None): + cb.ice_response() + def supportsRequiredParams_async(self, cb, current=None): cb.ice_response(False) diff --git a/python/test/Ice/optional/Test.ice b/python/test/Ice/optional/Test.ice index 733df305369..503483b5c1a 100644 --- a/python/test/Ice/optional/Test.ice +++ b/python/test/Ice/optional/Test.ice @@ -276,9 +276,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/python/test/Ice/optional/TestAMD.ice b/python/test/Ice/optional/TestAMD.ice index 60d86a247d9..ae7a8a57dab 100644 --- a/python/test/Ice/optional/TestAMD.ice +++ b/python/test/Ice/optional/TestAMD.ice @@ -277,9 +277,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/ruby/test/Ice/optional/AllTests.rb b/ruby/test/Ice/optional/AllTests.rb index da003618a69..167eddc9f37 100644 --- a/ruby/test/Ice/optional/AllTests.rb +++ b/ruby/test/Ice/optional/AllTests.rb @@ -318,8 +318,7 @@ def allTests(communicator) outer = Test::Recursive.new outer.value = recursive1 initial.pingPong(outer) - - + g = Test::G.new g.gg1Opt = Test::G1.new("gg1Opt") g.gg2 = Test::G2.new(10) @@ -331,6 +330,9 @@ def allTests(communicator) test(r.gg2Opt.a == 20) test(r.gg1.a == "gg1") + initial2 = Test::Initial2Prx::uncheckedCast(base) + initial2.opVoid(15, "test"); + puts "ok" print "testing marshaling of large containers with fixed size elements... " diff --git a/ruby/test/Ice/optional/ClientPrivate.ice b/ruby/test/Ice/optional/ClientPrivate.ice index 9a173d452e1..5dd08613b9a 100644 --- a/ruby/test/Ice/optional/ClientPrivate.ice +++ b/ruby/test/Ice/optional/ClientPrivate.ice @@ -32,6 +32,8 @@ class D extends B class Initial2 { void opClassAndUnknownOptional(A p, optional(1) Object o); + + void opVoid(optional(1) int a, optional(2) string v); }; }; diff --git a/ruby/test/Ice/optional/Test.ice b/ruby/test/Ice/optional/Test.ice index 5a66b8be45d..00751400009 100644 --- a/ruby/test/Ice/optional/Test.ice +++ b/ruby/test/Ice/optional/Test.ice @@ -276,9 +276,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py index 982c3221521..38841895312 100755 --- a/scripts/TestUtil.py +++ b/scripts/TestUtil.py @@ -128,7 +128,7 @@ def isSparc(): return False def isAIX(): - return sys.platform in ['aix4', 'aix5'] + return sys.platform.startswith("aix") def isDarwin(): return sys.platform == "darwin" @@ -342,6 +342,9 @@ toplevel = path[0] if isWin32(): if os.environ.get("PLATFORM", "").upper() == "X64": x64 = True +elif isAIX(): + if os.environ.get("OBJECT_MODE", "") == "64": + x64 = True else: p = subprocess.Popen("uname -m", shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT) if(p.wait() != 0): @@ -1925,7 +1928,10 @@ def getTestEnv(lang, testdir): if lang == "java": addLdPath(os.path.join(getIceDir("cpp"), "bin", "x64" if x64 else ""), env) # Add bin for db53_vc100.dll addLdPath(getCppLibDir(lang), env) + elif isAIX(): + addLdPath(getCppLibDir(lang), env) elif lang in ["python", "ruby", "php", "js", "objective-c"]: + # C++ binaries use rpath $ORIGIN or similar to find the Ice libraries addLdPath(getCppLibDir(lang), env) if lang == "java": diff --git a/scripts/icehashpassword.py b/scripts/icehashpassword.py index 7f85102f06d..6763143cab3 100644 --- a/scripts/icehashpassword.py +++ b/scripts/icehashpassword.py @@ -8,19 +8,16 @@ # # ********************************************************************** -import sys, getopt, passlib.hash, getpass +import sys, getopt, passlib.hash, passlib.hosts, getpass usePBKDF2 = sys.platform == "win32" or sys.platform == "darwin" useCryptExt = sys.platform.startswith("linux") -if not usePBKDF2 and not useCryptExt: - print("platform not supported") - sys.exit(1) - def usage(): print("Usage: icehashpassword [options]") print("") print("OPTIONS") + if usePBKDF2: print("") print(" -d MESSAGE_DIGEST_ALGORITHM, --digest=MESSAGE_DIGEST_ALGORITHM") @@ -103,7 +100,12 @@ def main(): passScheme = passlib.hash.sha512_crypt if digest == "sha256": passScheme = passlib.hash.sha256_crypt - + else: + # + # Fallback is the OS crypt function + # + passScheme = passlib.hosts.host_context + if rounds: if not passScheme.min_rounds <= rounds <= passScheme.max_rounds: print("Invalid number rounds for the digest algorithm. Value must be an integer between %s and %s" % |