You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2009/01/06 23:27:43 UTC
svn commit: r732153 -
/qpid/trunk/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp
Author: aconway
Date: Tue Jan 6 14:27:42 2009
New Revision: 732153
URL: http://svn.apache.org/viewvc?rev=732153&view=rev
Log:
cluster/OutputInterceptor.cpp: added locking around use of ClusterOutputinterceptor.
Modified:
qpid/trunk/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp
Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp?rev=732153&r1=732152&r2=732153&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/OutputInterceptor.cpp Tue Jan 6 14:27:42 2009
@@ -40,14 +40,19 @@
void OutputInterceptor::send(framing::AMQFrame& f) {
parent.getCluster().checkQuorum();
- next->send(f);
+ {
+ sys::Mutex::ScopedLock l(lock);
+ next->send(f);
+ }
if (!parent.isCatchUp())
sent += f.encodedSize();
}
void OutputInterceptor::activateOutput() {
- if (parent.isCatchUp())
+ if (parent.isCatchUp()) {
+ sys::Mutex::ScopedLock l(lock);
next->activateOutput();
+ }
else {
QPID_LOG(trace, parent << " activateOutput - sending doOutput");
moreOutput = true;
@@ -55,7 +60,10 @@
}
}
-void OutputInterceptor::giveReadCredit(int32_t credit) { next->giveReadCredit(credit); }
+void OutputInterceptor::giveReadCredit(int32_t credit) {
+ sys::Mutex::ScopedLock l(lock);
+ next->giveReadCredit(credit);
+}
// Called in write thread when the IO layer has no more data to write.
// We do nothing in the write thread, we run doOutput only on delivery
@@ -107,14 +115,17 @@
}
void OutputInterceptor::setOutputHandler(sys::ConnectionOutputHandler& h) {
+ sys::Mutex::ScopedLock l(lock);
next = &h;
}
void OutputInterceptor::close() {
+ sys::Mutex::ScopedLock l(lock);
next->close();
}
size_t OutputInterceptor::getBuffered() const {
+ sys::Mutex::ScopedLock l(lock);
return next->getBuffered();
}