summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-15 18:07:44 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-15 18:07:44 (GMT)
commitf061668e3c1d5eac01b85303e2c81df2bc560e9a (patch)
treede56afe6d93cb36425f7c2e458575d27bd9105a4 /Swiften/Server
parent0930cd940963be0edfe7c80b4925babca0e01443 (diff)
downloadswift-contrib-f061668e3c1d5eac01b85303e2c81df2bc560e9a.zip
swift-contrib-f061668e3c1d5eac01b85303e2c81df2bc560e9a.tar.bz2
Make stream stack layers reference counted.
Diffstat (limited to 'Swiften/Server')
-rw-r--r--Swiften/Server/ServerFromClientSession.cpp6
-rw-r--r--Swiften/Server/ServerFromClientSession.h4
2 files changed, 4 insertions, 6 deletions
diff --git a/Swiften/Server/ServerFromClientSession.cpp b/Swiften/Server/ServerFromClientSession.cpp
index 6d4aba1..67067c5 100644
--- a/Swiften/Server/ServerFromClientSession.cpp
+++ b/Swiften/Server/ServerFromClientSession.cpp
@@ -31,7 +31,7 @@ ServerFromClientSession::ServerFromClientSession(
userRegistry_(userRegistry),
authenticated_(false),
initialized_(false) {
- xmppLayer_ = new XMPPLayer(payloadParserFactories_, payloadSerializers_);
+ xmppLayer_ = boost::shared_ptr<XMPPLayer>(new XMPPLayer(payloadParserFactories_, payloadSerializers_));
xmppLayer_->onStreamStart.connect(
boost::bind(&ServerFromClientSession::handleStreamStart, this, _2));
xmppLayer_->onElement.connect(
@@ -42,14 +42,12 @@ ServerFromClientSession::ServerFromClientSession(
boost::bind(boost::ref(onDataRead), _1));
xmppLayer_->onWriteData.connect(
boost::bind(boost::ref(onDataWritten), _1));
- connectionLayer_ = new ConnectionLayer(connection_);
+ connectionLayer_ = boost::shared_ptr<ConnectionLayer>(new ConnectionLayer(connection_));
streamStack_ = new StreamStack(xmppLayer_, connectionLayer_);
}
ServerFromClientSession::~ServerFromClientSession() {
delete streamStack_;
- delete connectionLayer_;
- delete xmppLayer_;
}
void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element) {
diff --git a/Swiften/Server/ServerFromClientSession.h b/Swiften/Server/ServerFromClientSession.h
index 9c37b3d..62e89ef 100644
--- a/Swiften/Server/ServerFromClientSession.h
+++ b/Swiften/Server/ServerFromClientSession.h
@@ -55,9 +55,9 @@ namespace Swift {
UserRegistry* userRegistry_;
bool authenticated_;
bool initialized_;
- ConnectionLayer* connectionLayer_;
+ boost::shared_ptr<XMPPLayer> xmppLayer_;
+ boost::shared_ptr<ConnectionLayer> connectionLayer_;
StreamStack* streamStack_;
- XMPPLayer* xmppLayer_;
JID domain_;
String user_;
JID jid_;