summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-03-31 08:38:29 +0200
committerBenoit Foucher <benoit@zeroc.com>2016-03-31 08:38:29 +0200
commit04c83affba981565fcca3b3bfa2a3d96ca331c81 (patch)
tree8cf749969ff9209645130bb8e4433d837c77c6d6 /cpp
parentMerge remote-tracking branch 'origin/3.6' (diff)
parentFixed Glacier2 bug which would cause hang on shutdown (diff)
downloadice-04c83affba981565fcca3b3bfa2a3d96ca331c81.tar.bz2
ice-04c83affba981565fcca3b3bfa2a3d96ca331c81.tar.xz
ice-04c83affba981565fcca3b3bfa2a3d96ca331c81.zip
Merge remote-tracking branch 'origin/3.6'
Diffstat (limited to 'cpp')
-rwxr-xr-xcpp/allTests.py2
-rw-r--r--cpp/config/Make.rules.MINGW10
-rw-r--r--cpp/src/Glacier2/Blobject.cpp33
-rw-r--r--cpp/src/Glacier2/RequestQueue.cpp149
-rw-r--r--cpp/src/Glacier2/RequestQueue.h10
-rw-r--r--cpp/src/IceSSL/OpenSSLTransceiverI.cpp7
-rw-r--r--cpp/src/IceSSL/SecureTransportTransceiverI.cpp20
-rw-r--r--cpp/test/Glacier2/router/CallbackI.cpp36
-rw-r--r--cpp/test/Glacier2/router/CallbackI.h4
-rw-r--r--cpp/test/Glacier2/router/Client.cpp27
-rw-r--r--cpp/test/Ice/Makefile9
-rw-r--r--cpp/test/Ice/retry/Client.cpp3
-rw-r--r--cpp/test/Ice/retry/Server.cpp1
-rw-r--r--cpp/test/IceDiscovery/simple/Makefile8
-rw-r--r--cpp/test/IceUtil/stacktrace/Client.cpp78
15 files changed, 236 insertions, 161 deletions
diff --git a/cpp/allTests.py b/cpp/allTests.py
index fb48f7630c6..49ca349425e 100755
--- a/cpp/allTests.py
+++ b/cpp/allTests.py
@@ -78,7 +78,7 @@ tests = [
("Ice/enums", ["once", "bt"]),
("Ice/logger", ["once"]),
("Ice/networkProxy", ["core", "noipv6", "nosocks"]),
- ("Ice/services", ["once"]),
+ ("Ice/services", ["once", "nomingw"]),
("IceSSL/configuration", ["once", "novalgrind"]), # valgrind doesn't work well with openssl
("IceBox/configuration", ["core", "noipv6", "novc100", "nomingw", "nomx"]),
("IceBox/admin", ["core", "noipv6", "novc100", "nomingw", "nomx"]),
diff --git a/cpp/config/Make.rules.MINGW b/cpp/config/Make.rules.MINGW
index 10e67d222c0..7eb120e1b4a 100644
--- a/cpp/config/Make.rules.MINGW
+++ b/cpp/config/Make.rules.MINGW
@@ -23,7 +23,7 @@ CXX = c++
ICE_WIN32_WINNT := 0x601
CXXFLAGS = $(CXXARCHFLAGS) -mthreads -Wall -Werror -D_WIN32_WINNT=$(ICE_WIN32_WINNT) -DWIN32_LEAN_AND_MEAN
-LDFLAGS = -Wl,-no-undefined
+LDFLAGS = -Wl,-no-undefined
ifeq ($(STATICLIBS),yes)
CXXFLAGS += -DICE_STATIC_LIBS
@@ -105,7 +105,7 @@ libdir := $(top_srcdir)/$(libsubdir)
bindir := $(top_srcdir)/$(binsubdir)
installlib = $(INSTALL) $(2)/$(3) $(1); \
- chmod a+rx $(1)/$(3)
+ chmod a+rx $(1)/$(3)
installprogram = $(INSTALL_PROGRAM) $(1) $(2); \
chmod a+rx $(2)/$(notdir $(1))
@@ -114,16 +114,16 @@ SSL_OS_LIBS = -lsecur32 -lcrypt32 -lws2_32
ifeq ($(STATICLIBS),yes)
BASELIBS = -liceutil $(ICEUTIL_OS_LIBS)
-LIBS = -lice $(BASELIBS)
+LIBS = -lice $(BASELIBS)
ICESSL_LIBS = -licessl
SLICE_LIBS = -lslice $(BASELIBS)
else
BASELIBS = -liceutil$(SOVERSION)$(COMPSUFFIX) $(ICEUTIL_OS_LIBS)
-LIBS = -lice$(SOVERSION)$(COMPSUFFIX) $(BASELIBS)
+LIBS = -lice$(SOVERSION)$(COMPSUFFIX) $(BASELIBS)
ICESSL_LIBS = -licessl$(SOVERSION)$(COMPSUFFIX)
SLICE_LIBS = -lslice$(SOVERSION)$(COMPSUFFIX) $(BASELIBS)
endif
-ICEUTIL_OS_LIBS = -lrpcrt4 -ladvapi32
+ICEUTIL_OS_LIBS = -lrpcrt4 -ladvapi32 -lshlwapi
ICE_OS_LIBS = $(ICEUTIL_OS_LIBS) -lIphlpapi -lws2_32
EXE_EXT = .exe
diff --git a/cpp/src/Glacier2/Blobject.cpp b/cpp/src/Glacier2/Blobject.cpp
index a9c2ce55f80..1f58da34ffb 100644
--- a/cpp/src/Glacier2/Blobject.cpp
+++ b/cpp/src/Glacier2/Blobject.cpp
@@ -48,7 +48,7 @@ Glacier2::Blobject::Blobject(const InstancePtr& instance, const ConnectionPtr& r
_instance->properties()->getPropertyAsInt(clientTraceOverride)),
_context(context)
{
- RequestQueueThreadPtr t = _reverseConnection ? _instance->serverRequestQueueThread() :
+ RequestQueueThreadPtr t = _reverseConnection ? _instance->serverRequestQueueThread() :
_instance->clientRequestQueueThread();
if(t)
{
@@ -86,17 +86,14 @@ Glacier2::Blobject::invokeResponse(bool ok, const pair<const Byte*, const Byte*>
}
void
-Glacier2::Blobject::invokeSent(bool sent, const AMD_Object_ice_invokePtr& amdCB)
+Glacier2::Blobject::invokeSent(bool, const AMD_Object_ice_invokePtr& amdCB)
{
- if(sent)
- {
#if (defined(_MSC_VER) && (_MSC_VER >= 1600))
- amdCB->ice_response(true, pair<const Byte*, const Byte*>(static_cast<const Byte*>(nullptr),
- static_cast<const Byte*>(nullptr)));
+ amdCB->ice_response(true, pair<const Byte*, const Byte*>(static_cast<const Byte*>(nullptr),
+ static_cast<const Byte*>(nullptr)));
#else
- amdCB->ice_response(true, pair<const Byte*, const Byte*>(0, 0));
+ amdCB->ice_response(true, pair<const Byte*, const Byte*>(0, 0));
#endif
- }
}
void
@@ -124,7 +121,7 @@ Glacier2::Blobject::invokeException(const Exception& ex, const AMD_Object_ice_in
}
void
-Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Object_ice_invokePtr& amdCB,
+Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Object_ice_invokePtr& amdCB,
const std::pair<const Byte*, const Byte*>& inParams, const Current& current)
{
//
@@ -171,7 +168,7 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Object_ice_invokePtr& amd
proxy = proxy->ice_twoway();
break;
}
-
+
case 'o':
{
if(_alwaysBatch && _requestQueue)
@@ -184,7 +181,7 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Object_ice_invokePtr& amd
}
break;
}
-
+
case 'd':
{
if(_alwaysBatch && _requestQueue)
@@ -197,7 +194,7 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Object_ice_invokePtr& amd
}
break;
}
-
+
case 'O':
{
if(_requestQueue)
@@ -210,7 +207,7 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Object_ice_invokePtr& amd
}
break;
}
-
+
case 'D':
{
if(_requestQueue)
@@ -223,19 +220,19 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Object_ice_invokePtr& amd
}
break;
}
-
+
case 's':
{
proxy = proxy->ice_secure(true);
break;
}
-
+
case 'z':
{
proxy = proxy->ice_compress(true);
break;
}
-
+
default:
{
Warning out(_instance->logger());
@@ -245,7 +242,7 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Object_ice_invokePtr& amd
}
}
}
-
+
if(_requestTraceLevel >= 1)
{
Trace out(_instance->logger(), "Glacier2");
@@ -284,7 +281,7 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Object_ice_invokePtr& amd
}
if(_requestQueue)
- {
+ {
//
// If we are in buffered mode, we create a new request and add
// it to the request queue. If the request is twoway, we use
diff --git a/cpp/src/Glacier2/RequestQueue.cpp b/cpp/src/Glacier2/RequestQueue.cpp
index 78eff63bce0..5acc66dbfa9 100644
--- a/cpp/src/Glacier2/RequestQueue.cpp
+++ b/cpp/src/Glacier2/RequestQueue.cpp
@@ -10,7 +10,6 @@
#include <Glacier2/RequestQueue.h>
#include <Glacier2/Instance.h>
#include <Glacier2/SessionRouterI.h>
-#include <set>
using namespace std;
using namespace Ice;
@@ -33,6 +32,19 @@ Glacier2::Request::Request(const ObjectPrx& proxy, const std::pair<const Byte*,
}
}
+void
+Glacier2::Request::addBatchProxy(set<Ice::ObjectPrx>& batchProxies)
+{
+ set<Ice::ObjectPrx>::const_iterator p = batchProxies.find(_proxy);
+ if(p == batchProxies.end())
+ {
+ batchProxies.insert(_proxy);
+ }
+ else if(p->get() != _proxy.get())
+ {
+ const_cast<Ice::ObjectPrx&>(_proxy) = *p;
+ }
+}
Ice::AsyncResultPtr
Glacier2::Request::invoke(const Callback_Object_ice_invokePtr& cb)
@@ -52,7 +64,7 @@ Glacier2::Request::invoke(const Callback_Object_ice_invokePtr& cb)
{
ByteSeq outParams;
if(_forwardContext)
- {
+ {
if(_sslContext.size() > 0)
{
Ice::Context ctx = _current.ctx;
@@ -81,7 +93,7 @@ Glacier2::Request::invoke(const Callback_Object_ice_invokePtr& cb)
{
Ice::AsyncResultPtr result;
if(_forwardContext)
- {
+ {
if(_sslContext.size() > 0)
{
Ice::Context ctx = _current.ctx;
@@ -131,7 +143,7 @@ Glacier2::Request::override(const RequestPtr& other) const
//
// Don't override if the override isn't the same.
- //
+ //
if(_override != other->_override)
{
return false;
@@ -163,13 +175,13 @@ Glacier2::Request::exception(const Ice::Exception& ex)
}
}
-void
+void
Glacier2::Request::queued()
{
if(!_proxy->ice_isTwoway())
{
#if (defined(_MSC_VER) && (_MSC_VER >= 1600))
- _amdCB->ice_response(true, pair<const Byte*, const Byte*>(static_cast<const Byte*>(nullptr),
+ _amdCB->ice_response(true, pair<const Byte*, const Byte*>(static_cast<const Byte*>(nullptr),
static_cast<const Byte*>(nullptr)));
#else
_amdCB->ice_response(true, pair<const Byte*, const Byte*>(0, 0));
@@ -177,8 +189,8 @@ Glacier2::Request::queued()
}
}
-Glacier2::RequestQueue::RequestQueue(const RequestQueueThreadPtr& requestQueueThread,
- const InstancePtr& instance,
+Glacier2::RequestQueue::RequestQueue(const RequestQueueThreadPtr& requestQueueThread,
+ const InstancePtr& instance,
const Ice::ConnectionPtr& connection) :
_requestQueueThread(requestQueueThread),
_instance(instance),
@@ -219,7 +231,17 @@ Glacier2::RequestQueue::addRequest(const RequestPtr& request)
}
}
}
-
+
+ if(!_connection)
+ {
+ //
+ // If it's a batch request, we make sure we use a unique batch proxy object for the queued
+ // batch requests. We want all the requests for the same batch proxy to be queued on the
+ // same proxy object.
+ //
+ request->addBatchProxy(_batchProxies);
+ }
+
//
// No override, we add the new request.
//
@@ -237,7 +259,7 @@ Glacier2::RequestQueue::addRequest(const RequestPtr& request)
}
void
-Glacier2::RequestQueue::flushRequests(set<Ice::ObjectPrx>& batchProxies)
+Glacier2::RequestQueue::flushRequests()
{
IceUtil::Mutex::Lock lock(*this);
if(_connection)
@@ -250,7 +272,34 @@ Glacier2::RequestQueue::flushRequests(set<Ice::ObjectPrx>& batchProxies)
}
else
{
- flush(batchProxies);
+ for(deque<RequestPtr>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
+ {
+ try
+ {
+ if(_observer)
+ {
+ _observer->forwarded(!_connection);
+ }
+ assert(_callback);
+ (*p)->invoke(_callback);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // Ignore, this can occur for batch requests.
+ }
+ }
+ _requests.clear();
+
+ for(set<Ice::ObjectPrx>::const_iterator q = _batchProxies.begin(); q != _batchProxies.end(); ++q)
+ {
+ (*q)->begin_ice_flushBatchRequests();
+ }
+ _batchProxies.clear();
+ }
+
+ if(_destroyed && _requests.empty())
+ {
+ destroyInternal();
}
}
@@ -279,20 +328,6 @@ Glacier2::RequestQueue::updateObserver(const Glacier2::Instrumentation::SessionO
}
void
-Glacier2::RequestQueue::destroyInternal()
-{
- //
- // Must be called with the mutex locked.
- //
-
- //
- // Remove cyclic references.
- //
- const_cast<Ice::Callback_Object_ice_invokePtr&>(_callback) = 0;
- const_cast<Ice::Callback_Connection_flushBatchRequestsPtr&>(_flushCallback) = 0;
-}
-
-void
Glacier2::RequestQueue::flush()
{
assert(_connection);
@@ -314,7 +349,7 @@ Glacier2::RequestQueue::flush()
if(!result)
{
flushBatchRequests = true;
- }
+ }
else if(!result->sentSynchronously() && !result->isCompleted())
{
_pendingSend = true;
@@ -346,44 +381,20 @@ Glacier2::RequestQueue::flush()
_pendingSendRequest = 0;
}
}
-
- if(_destroyed && _requests.empty())
- {
- destroyInternal();
- }
}
void
-Glacier2::RequestQueue::flush(set<Ice::ObjectPrx>& batchProxies)
+Glacier2::RequestQueue::destroyInternal()
{
- assert(!_connection);
-
- for(deque<RequestPtr>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
- {
- try
- {
- if(_observer)
- {
- _observer->forwarded(!_connection);
- }
- assert(_callback);
- Ice::AsyncResultPtr result = (*p)->invoke(_callback);
- if(!result)
- {
- batchProxies.insert((*p)->getProxy());
- }
- }
- catch(const Ice::LocalException&)
- {
- // Ignore, this can occur for batch requests.
- }
- }
- _requests.clear();
+ //
+ // Must be called with the mutex locked.
+ //
- if(_destroyed)
- {
- destroyInternal();
- }
+ //
+ // Remove cyclic references.
+ //
+ const_cast<Ice::Callback_Object_ice_invokePtr&>(_callback) = 0;
+ const_cast<Ice::Callback_Connection_flushBatchRequestsPtr&>(_flushCallback) = 0;
}
void
@@ -427,7 +438,7 @@ Glacier2::RequestQueue::exception(const Ice::Exception& ex, const RequestPtr& re
}
}
-void
+void
Glacier2::RequestQueue::sent(bool sentSynchronously, const RequestPtr& request)
{
if(_connection && !sentSynchronously)
@@ -454,12 +465,12 @@ Glacier2::RequestQueueThread::~RequestQueueThread()
assert(_queues.empty());
}
-void
+void
Glacier2::RequestQueueThread::destroy()
{
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
-
+
assert(!_destroy);
_destroy = true;
_sleep = false;
@@ -534,7 +545,7 @@ Glacier2::RequestQueueThread::run()
}
//
- // If the queue is being destroyed and there's no requests or responses
+ // If the queue is being destroyed and there's no requests or responses
// to send, we're done.
//
if(_destroy && _queues.empty())
@@ -543,7 +554,7 @@ Glacier2::RequestQueueThread::run()
}
assert(!_queues.empty() && !_sleep);
-
+
queues.swap(_queues);
if(_sleepTime > IceUtil::Time())
@@ -552,16 +563,10 @@ Glacier2::RequestQueueThread::run()
_sleepDuration = _sleepTime;
}
}
-
- set<Ice::ObjectPrx> flushProxySet;
- for(vector<RequestQueuePtr>::const_iterator p = queues.begin(); p != queues.end(); ++p)
- {
- (*p)->flushRequests(flushProxySet);
- }
- for(set<Ice::ObjectPrx>::const_iterator q = flushProxySet.begin(); q != flushProxySet.end(); ++q)
+ for(vector<RequestQueuePtr>::const_iterator p = queues.begin(); p != queues.end(); ++p)
{
- (*q)->begin_ice_flushBatchRequests();
+ (*p)->flushRequests();
}
}
}
diff --git a/cpp/src/Glacier2/RequestQueue.h b/cpp/src/Glacier2/RequestQueue.h
index d918584e1d5..94ca48b089f 100644
--- a/cpp/src/Glacier2/RequestQueue.h
+++ b/cpp/src/Glacier2/RequestQueue.h
@@ -36,10 +36,10 @@ public:
Request(const Ice::ObjectPrx&, const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&, bool,
const Ice::Context&, const Ice::AMD_Object_ice_invokePtr&);
-
+
Ice::AsyncResultPtr invoke(const Ice::Callback_Object_ice_invokePtr& callback);
bool override(const RequestPtr&) const;
- const Ice::ObjectPrx& getProxy() const { return _proxy; }
+ void addBatchProxy(std::set<Ice::ObjectPrx>&);
bool hasOverride() const { return !_override.empty(); }
private:
@@ -65,7 +65,7 @@ public:
RequestQueue(const RequestQueueThreadPtr&, const InstancePtr&, const Ice::ConnectionPtr&);
bool addRequest(const RequestPtr&);
- void flushRequests(std::set<Ice::ObjectPrx>&);
+ void flushRequests();
void destroy();
@@ -76,12 +76,11 @@ private:
void destroyInternal();
void flush();
- void flush(std::set<Ice::ObjectPrx>&);
void response(bool, const std::pair<const Ice::Byte*, const Ice::Byte*>&, const RequestPtr&);
void exception(const Ice::Exception&, const RequestPtr&);
void sent(bool, const RequestPtr&);
-
+
const RequestQueueThreadPtr _requestQueueThread;
const InstancePtr _instance;
const Ice::ConnectionPtr _connection;
@@ -89,6 +88,7 @@ private:
const Ice::Callback_Connection_flushBatchRequestsPtr _flushCallback;
std::deque<RequestPtr> _requests;
+ std::set<Ice::ObjectPrx> _batchProxies;
bool _pendingSend;
RequestPtr _pendingSendRequest;
bool _destroyed;
diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
index 99248a74a2d..2178c292ea0 100644
--- a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
+++ b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
@@ -466,6 +466,8 @@ IceSSL::TransceiverI::read(IceInternal::Buffer& buf)
return IceInternal::SocketOperationNone;
}
+ _stream->ready(IceInternal::SocketOperationRead, false);
+
//
// It's impossible for packetSize to be more than an Int.
//
@@ -555,6 +557,11 @@ IceSSL::TransceiverI::read(IceInternal::Buffer& buf)
}
}
+ //
+ // Check if there's still buffered data to read, set the read ready status.
+ //
+ _stream->ready(IceInternal::SocketOperationRead, SSL_pending(_ssl) > 0);
+
return IceInternal::SocketOperationNone;
}
diff --git a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp
index dc9d421b957..b043ef19713 100644
--- a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp
+++ b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp
@@ -407,17 +407,13 @@ IceSSL::TransceiverI::read(IceInternal::Buffer& buf)
return _stream->read(buf);
}
- //
- // Note: we assume that SecureTransport doesn't read more SSL records
- // than necessary to fill the requested data and that the sender sends
- // Ice messages in individual SSL records.
- //
-
if(buf.i == buf.b.end())
{
return IceInternal::SocketOperationNone;
}
+ _stream->ready(IceInternal::SocketOperationRead, false);
+
size_t packetSize = std::min(static_cast<size_t>(buf.b.end() - buf.i), _maxRecvPacketSize);
while(buf.i != buf.b.end())
{
@@ -464,6 +460,18 @@ IceSSL::TransceiverI::read(IceInternal::Buffer& buf)
packetSize = buf.b.end() - buf.i;
}
}
+
+ //
+ // Check if there's still buffered data to read. In this case, set the read ready status.
+ //
+ size_t buffered = 0;
+ OSStatus err = SSLGetBufferedReadSize(_ssl, &buffered);
+ if(err)
+ {
+ errno = err;
+ throw SocketException(__FILE__, __LINE__, IceInternal::getSocketErrno());
+ }
+ _stream->ready(IceInternal::SocketOperationRead, buffered > 0);
return IceInternal::SocketOperationNone;
}
diff --git a/cpp/test/Glacier2/router/CallbackI.cpp b/cpp/test/Glacier2/router/CallbackI.cpp
index ccf22fe5a15..365a7b3d896 100644
--- a/cpp/test/Glacier2/router/CallbackI.cpp
+++ b/cpp/test/Glacier2/router/CallbackI.cpp
@@ -109,7 +109,7 @@ public:
typedef IceUtil::Handle<AsyncCB> AsyncCBPtr;
CallbackReceiverI::CallbackReceiverI() :
- _callback(false),
+ _callback(0),
_waitCallback(false),
_callbackWithPayload(false),
_finishWaitCallback(false)
@@ -120,8 +120,7 @@ void
CallbackReceiverI::callback(const Current&)
{
Lock sync(*this);
- assert(!_callback);
- _callback = true;
+ ++_callback;
notifyAll();
}
@@ -179,16 +178,15 @@ CallbackReceiverI::callbackWithPayload(const Ice::ByteSeq&, const Current&)
}
void
-CallbackReceiverI::callbackOK()
+CallbackReceiverI::callbackOK(int expected)
{
Lock sync(*this);
- while(!_callback)
+ while(_callback != expected)
{
wait();
}
-
- _callback = false;
+ _callback = 0;
}
void
@@ -254,8 +252,8 @@ CallbackI::initiateCallback_async(const AMD_Callback_initiateCallbackPtr& cb,
if(proxy->ice_isTwoway())
{
AsyncCBPtr acb = new AsyncCB();
- proxy->begin_callback(current.ctx,
- newCallback_CallbackReceiver_callback(acb, &AsyncCB::responseCallback, &AsyncCB::exceptionCallback),
+ proxy->begin_callback(current.ctx,
+ newCallback_CallbackReceiver_callback(acb, &AsyncCB::responseCallback, &AsyncCB::exceptionCallback),
newCookie(cb));
}
else
@@ -272,8 +270,8 @@ CallbackI::initiateCallbackEx_async(const AMD_Callback_initiateCallbackExPtr& cb
if(proxy->ice_isTwoway())
{
AsyncCBPtr acb = new AsyncCB();
- proxy->begin_callbackEx(current.ctx,
- newCallback_CallbackReceiver_callbackEx(acb, &AsyncCB::responseCallbackEx, &AsyncCB::exceptionCallbackEx),
+ proxy->begin_callbackEx(current.ctx,
+ newCallback_CallbackReceiver_callbackEx(acb, &AsyncCB::responseCallbackEx, &AsyncCB::exceptionCallbackEx),
newCookie(cb));
}
else
@@ -290,32 +288,32 @@ CallbackI::initiateConcurrentCallback_async(const AMD_Callback_initiateConcurren
const Current& current)
{
AsyncCBPtr acb = new AsyncCB();
- proxy->begin_concurrentCallback(number, current.ctx,
+ proxy->begin_concurrentCallback(number, current.ctx,
newCallback_CallbackReceiver_concurrentCallback(acb, &AsyncCB::responseConcurrentCallback,
- &AsyncCB::exceptionConcurrentCallback),
+ &AsyncCB::exceptionConcurrentCallback),
newCookie(cb));
}
void
CallbackI::initiateWaitCallback_async(const AMD_Callback_initiateWaitCallbackPtr& cb,
- const CallbackReceiverPrx& proxy,
+ const CallbackReceiverPrx& proxy,
const Current& current)
{
AsyncCBPtr acb = new AsyncCB();
- proxy->begin_waitCallback(current.ctx,
+ proxy->begin_waitCallback(current.ctx,
newCallback_CallbackReceiver_waitCallback(acb, &AsyncCB::responseWaitCallback, &AsyncCB::exceptionWaitCallback),
newCookie(cb));
}
void
-CallbackI::initiateCallbackWithPayload_async(const AMD_Callback_initiateCallbackWithPayloadPtr& cb,
- const CallbackReceiverPrx& proxy,
+CallbackI::initiateCallbackWithPayload_async(const AMD_Callback_initiateCallbackWithPayloadPtr& cb,
+ const CallbackReceiverPrx& proxy,
const Current& current)
{
Ice::ByteSeq seq(1000 * 1024, 0);
AsyncCBPtr acb = new AsyncCB();
- proxy->begin_callbackWithPayload(seq, current.ctx,
- newCallback_CallbackReceiver_callbackWithPayload(acb, &AsyncCB::responseCallbackWithPayload,
+ proxy->begin_callbackWithPayload(seq, current.ctx,
+ newCallback_CallbackReceiver_callbackWithPayload(acb, &AsyncCB::responseCallbackWithPayload,
&AsyncCB::exceptionCallbackWithPayload),
newCookie(cb));
}
diff --git a/cpp/test/Glacier2/router/CallbackI.h b/cpp/test/Glacier2/router/CallbackI.h
index 548c8f64239..2d9841f660c 100644
--- a/cpp/test/Glacier2/router/CallbackI.h
+++ b/cpp/test/Glacier2/router/CallbackI.h
@@ -30,7 +30,7 @@ public:
virtual void waitCallback(const ::Ice::Current&);
virtual void callbackWithPayload(const Ice::ByteSeq&, const ::Ice::Current&);
- void callbackOK();
+ void callbackOK(int = 1);
void waitCallbackOK();
void callbackWithPayloadOK();
void notifyWaitCallback();
@@ -38,7 +38,7 @@ public:
private:
- bool _callback;
+ int _callback;
bool _waitCallback;
bool _callbackWithPayload;
bool _finishWaitCallback;
diff --git a/cpp/test/Glacier2/router/Client.cpp b/cpp/test/Glacier2/router/Client.cpp
index 5f7d4152cb7..1987e693dbc 100644
--- a/cpp/test/Glacier2/router/Client.cpp
+++ b/cpp/test/Glacier2/router/Client.cpp
@@ -612,7 +612,10 @@ CallbackClient::run(int argc, char* argv[])
Context context;
context["_fwd"] = "o";
oneway->initiateCallback(onewayR, context);
- callbackReceiverImpl->callbackOK();
+ oneway->initiateCallback(onewayR, context);
+ oneway->initiateCallback(onewayR, context);
+ oneway->initiateCallback(onewayR, context);
+ callbackReceiverImpl->callbackOK(4);
cout << "ok" << endl;
}
@@ -621,7 +624,27 @@ CallbackClient::run(int argc, char* argv[])
Context context;
context["_fwd"] = "t";
twoway->initiateCallback(twowayR, context);
- callbackReceiverImpl->callbackOK();
+ twoway->initiateCallback(twowayR, context);
+ twoway->initiateCallback(twowayR, context);
+ twoway->initiateCallback(twowayR, context);
+ callbackReceiverImpl->callbackOK(4);
+ cout << "ok" << endl;
+ }
+
+ {
+ cout << "testing batch oneway callback... " << flush;
+ Context context;
+ context["_fwd"] = "O";
+ CallbackPrx batchOneway = CallbackPrx::uncheckedCast(twoway->ice_batchOneway());
+ CallbackReceiverPrx onewayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_oneway());
+ batchOneway->initiateCallback(onewayR, context);
+ batchOneway->initiateCallback(onewayR, context);
+ batchOneway->initiateCallback(onewayR, context);
+ batchOneway->initiateCallback(onewayR, context);
+ batchOneway->initiateCallback(onewayR, context);
+ batchOneway->initiateCallback(onewayR, context);
+ batchOneway->ice_flushBatchRequests();
+ callbackReceiverImpl->callbackOK(6);
cout << "ok" << endl;
}
diff --git a/cpp/test/Ice/Makefile b/cpp/test/Ice/Makefile
index b9babdaeab6..94f9a14682e 100644
--- a/cpp/test/Ice/Makefile
+++ b/cpp/test/Ice/Makefile
@@ -46,8 +46,6 @@ SUBDIRS = proxy \
metrics \
enums \
logger \
- networkProxy \
- services \
impl \
stream
@@ -56,7 +54,12 @@ SUBDIRS := $(SUBDIRS) \
optional \
gc \
custom \
- echo
+ echo \
+ networkProxy
+endif
+
+ifeq ($(findstring MINGW,$(UNAME)),)
+SUBDIRS := $(SUBDIRS) services
endif
.PHONY: $(EVERYTHING) $(SUBDIRS)
diff --git a/cpp/test/Ice/retry/Client.cpp b/cpp/test/Ice/retry/Client.cpp
index 9efc4a6c764..176071a2f71 100644
--- a/cpp/test/Ice/retry/Client.cpp
+++ b/cpp/test/Ice/retry/Client.cpp
@@ -44,6 +44,9 @@ main(int argc, char* argv[])
//
initData.properties->setProperty("Ice.Warn.Connections", "0");
+ // Disable PrintStackTraces otherwise the test can fail on Windows/Debug
+ initData.properties->setProperty("Ice.PrintStackTraces", "0");
+
initData.properties->setProperty("Ice.RetryIntervals", "0 1 10 1");
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/retry/Server.cpp b/cpp/test/Ice/retry/Server.cpp
index 36ebe9b3a0a..ceb38ab5282 100644
--- a/cpp/test/Ice/retry/Server.cpp
+++ b/cpp/test/Ice/retry/Server.cpp
@@ -39,6 +39,7 @@ main(int argc, char* argv[])
Ice::InitializationData initData;
initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
+ initData.properties->setProperty("Ice.PrintStackTraces", "0");
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
diff --git a/cpp/test/IceDiscovery/simple/Makefile b/cpp/test/IceDiscovery/simple/Makefile
index aaa46cb42e6..ffff74f3bef 100644
--- a/cpp/test/IceDiscovery/simple/Makefile
+++ b/cpp/test/IceDiscovery/simple/Makefile
@@ -31,9 +31,15 @@ include $(top_srcdir)/config/Make.rules
CPPFLAGS := -I. -I../../include $(CPPFLAGS)
+ifneq ($(findstring MINGW,$(UNAME)),)
+ICEDISOVERY_LIBS = -licediscovery$(SOVERSION)$(COMPSUFFIX)
+else
+ICEDISOVERY_LIBS = -lIceDiscovery
+endif
+
$(CLIENT): $(COBJS)
rm -f $@
- $(call mktest,$@,$(COBJS), -lIceDiscovery $(LIBS))
+ $(call mktest,$@,$(COBJS), $(ICEDISOVERY_LIBS) $(LIBS))
$(SERVER): $(SOBJS)
rm -f $@
diff --git a/cpp/test/IceUtil/stacktrace/Client.cpp b/cpp/test/IceUtil/stacktrace/Client.cpp
index 7e12df183d6..4a16654b698 100644
--- a/cpp/test/IceUtil/stacktrace/Client.cpp
+++ b/cpp/test/IceUtil/stacktrace/Client.cpp
@@ -224,42 +224,66 @@ int main(int argc, char* argv[])
filename += ".Linux";
#endif
- ifstream ifs(filename.c_str());
- stringstream sstr;
- sstr << ifs.rdbuf();
+ while(true)
+ {
+ ifstream ifs(filename.c_str());
+ stringstream sstr;
+ sstr << ifs.rdbuf();
#if defined(__APPLE__)
- string expected = sstr.str();
- standardizeVersion(expected);
+ string expected = sstr.str();
+ standardizeVersion(expected);
#else
- vector<string> expected = splitLines(sstr.str());
+ vector<string> expected = splitLines(sstr.str());
#endif
- ThrowerPtr thrower = new Thrower();
- try
- {
- thrower->first();
- }
- catch(const IceUtil::Exception& ex)
- {
- string stack = ex.ice_stackTrace();
-#ifdef __APPLE__
- standardizeVersion(stack);
- if(expected.size() < stack.size())
+ ThrowerPtr thrower = new Thrower();
+ try
{
- test(stack.compare(0, expected.size(), expected) == 0);
+ thrower->first();
}
- else
+ catch(const IceUtil::Exception& ex)
{
- test(stack == expected);
- }
+ string stack = ex.ice_stackTrace();
+#ifdef __APPLE__
+ standardizeVersion(stack);
+ if(expected.size() < stack.size())
+ {
+ test(stack.compare(0, expected.size(), expected) == 0);
+ }
+ else
+ {
+ test(stack == expected);
+ }
+ break;
#else
- vector<string> actual = splitLines(stack);
- test(expected.size() <= actual.size());
- for(size_t i = 0; i < expected.size(); ++i)
- {
- test(actual[i].find(expected[i]) != string::npos);
- }
+ vector<string> actual = splitLines(stack);
+ test(expected.size() <= actual.size());
+ for(size_t i = 0; i < expected.size(); ++i)
+ {
+ if(actual[i].find(expected[i]) == string::npos)
+ {
+#if defined(_WIN32) && defined(NDEBUG)
+ //
+ // With windows optimized builds retry with the alternate
+ // expect file.
+ //
+ if(filename != "StackTrace.release.Win32")
+ {
+ filename = "StackTrace.release.Win32";
+ continue;
+ }
+ else
+ {
+ test(false);
+ }
+#else
+ test(false);
+#endif
+ }
+ }
+ break;
#endif
+ }
}
cout << "ok" << endl;
#else