diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-03-28 13:40:14 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-03-28 13:40:43 (GMT) |
commit | b61486fefe602e0d18fa5279021006f87b965307 (patch) | |
tree | 437585cbef1179e1ec31f79789591d5610200c29 /Swiften/StreamStack/StreamStack.cpp | |
parent | dae28dd45e43fc6e6ef2ec4c6c65d5d736ed86f8 (diff) | |
download | swift-contrib-b61486fefe602e0d18fa5279021006f87b965307.zip swift-contrib-b61486fefe602e0d18fa5279021006f87b965307.tar.bz2 |
Moved Swiften to a separate module.
Diffstat (limited to 'Swiften/StreamStack/StreamStack.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/StreamStack/StreamStack.cpp | 40 |
2 files changed, 0 insertions, 40 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/StreamStack/StreamStack.cpp b/Swiften/StreamStack/StreamStack.cpp deleted file mode 100644 index 9eb9b4e..0000000 --- a/Swiften/StreamStack/StreamStack.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "Swiften/StreamStack/StreamStack.h" - -#include <boost/bind.hpp> - -#include "Swiften/Base/foreach.h" -#include "Swiften/StreamStack/XMPPLayer.h" -#include "Swiften/StreamStack/LowLayer.h" -#include "Swiften/StreamStack/StreamLayer.h" - -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() { - // 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(); - - boost::shared_ptr<LowLayer> lowLayer = (layers_.empty() ? physicalLayer_ : *layers_.rbegin()); - - 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); -} - -} |