summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-12-19 14:10:39 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-12-19 17:17:45 (GMT)
commitd67ecb18c1178ecf69e6cb5e8c8ee1fecee35e4c (patch)
tree5f05b975ae39b2318d85f9ed673e2434f2916981 /Swiften/StreamStack/StreamStack.cpp
parente8b2e33a6fc569af116a32ebb5e441728e390c8f (diff)
downloadswift-d67ecb18c1178ecf69e6cb5e8c8ee1fecee35e4c.zip
swift-d67ecb18c1178ecf69e6cb5e8c8ee1fecee35e4c.tar.bz2
Refactoring streamstack to not use signal/slots.
Diffstat (limited to 'Swiften/StreamStack/StreamStack.cpp')
-rw-r--r--Swiften/StreamStack/StreamStack.cpp28
1 files changed, 10 insertions, 18 deletions
diff --git a/Swiften/StreamStack/StreamStack.cpp b/Swiften/StreamStack/StreamStack.cpp
index b0c68cf..2a30768 100644
--- a/Swiften/StreamStack/StreamStack.cpp
+++ b/Swiften/StreamStack/StreamStack.cpp
@@ -15,31 +15,23 @@
namespace Swift {
-StreamStack::StreamStack(boost::shared_ptr<XMPPLayer> xmppLayer, boost::shared_ptr<LowLayer> physicalLayer) : xmppLayer_(xmppLayer), physicalLayer_(physicalLayer) {
- xmppReadSlotConnection_ = physicalLayer_->onDataRead.connect(boost::bind(&XMPPLayer::parseData, xmppLayer_, _1));
- xmppWriteSignalConnection_ = xmppLayer_->onWriteData.connect(boost::bind(&LowLayer::writeData, physicalLayer_, _1));
+StreamStack::StreamStack(XMPPLayer* xmppLayer, LowLayer* physicalLayer) : xmppLayer_(xmppLayer), physicalLayer_(physicalLayer) {
+ physicalLayer_->setParentLayer(xmppLayer_);
+ xmppLayer_->setChildLayer(physicalLayer_);
}
StreamStack::~StreamStack() {
- // Disconnect the write signal connections to break cyclic signal
- // dependencies. The read signal connections have
- // to remain, since these can be reached from the main event loop.
- xmppWriteSignalConnection_.disconnect();
- foreach(const boost::bsignals::connection& connection, writeSignalConnections_) {
- connection.disconnect();
- }
}
-void StreamStack::addLayer(boost::shared_ptr<StreamLayer> newLayer) {
- xmppReadSlotConnection_.disconnect();
- xmppWriteSignalConnection_.disconnect();
+void StreamStack::addLayer(StreamLayer* newLayer) {
+ LowLayer* lowLayer = layers_.empty() ? physicalLayer_ : *layers_.rbegin();
- boost::shared_ptr<LowLayer> lowLayer = (layers_.empty() ? physicalLayer_ : *layers_.rbegin());
+ xmppLayer_->setChildLayer(newLayer);
+ newLayer->setParentLayer(xmppLayer_);
+
+ lowLayer->setParentLayer(newLayer);
+ newLayer->setChildLayer(lowLayer);
- lowLayer->onDataRead.connect(boost::bind(&HighLayer::handleDataRead, newLayer, _1), boost::bsignals::at_front);
- writeSignalConnections_.push_back(newLayer->onWriteData.connect(boost::bind(&LowLayer::writeData, lowLayer, _1), boost::bsignals::at_front));
- xmppWriteSignalConnection_ = xmppLayer_->onWriteData.connect(boost::bind(&LowLayer::writeData, newLayer, _1), boost::bsignals::at_front);
- xmppReadSlotConnection_ = newLayer->onDataRead.connect(boost::bind(&XMPPLayer::parseData, xmppLayer_, _1), boost::bsignals::at_front);
layers_.push_back(newLayer);
}