summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ConnectionFactory.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-09-04 02:11:46 +0000
committerMichi Henning <michi@zeroc.com>2003-09-04 02:11:46 +0000
commit5ecbdf0ebe5efd151129d4422b30b7aefe11f9db (patch)
treefca4840b748039de1d06e78170bb3c6ca23f6933 /cpp/src/Ice/ConnectionFactory.cpp
parentFixed IcePack test cleaning (diff)
downloadice-5ecbdf0ebe5efd151129d4422b30b7aefe11f9db.tar.bz2
ice-5ecbdf0ebe5efd151129d4422b30b7aefe11f9db.tar.xz
ice-5ecbdf0ebe5efd151129d4422b30b7aefe11f9db.zip
Fixed race condition in flushBatchRequests(): connections that are not yet
validated are now ignored when flushing.
Diffstat (limited to 'cpp/src/Ice/ConnectionFactory.cpp')
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index ae99f562611..1d6227ecd81 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -510,11 +510,26 @@ IceInternal::IncomingConnectionFactory::connections() const
return result;
}
+namespace IceInternal {
+
+struct FlushIfValidated
+{
+ void operator() (ConnectionPtr p)
+ {
+ if(p->isValidated())
+ {
+ p->flushBatchRequest();
+ }
+ }
+};
+
+}
+
void
IceInternal::IncomingConnectionFactory::flushBatchRequests()
{
- list<ConnectionPtr> c = connections(); // connections() is synchronized, so need to synchronize here.
- for_each(c.begin(), c.end(), Ice::voidMemFun(&Connection::flushBatchRequest));
+ list<ConnectionPtr> c = connections(); // connections() is synchronized, so no need to synchronize here.
+ for_each(c.begin(), c.end(), FlushIfValidated());
}
bool