summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-01-22 13:31:54 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-01-22 13:31:54 (GMT)
commit940cb5e744564ec15b805a9e5388e1fa5c60d703 (patch)
tree9c5ed10128c5869c99dbeacc251234802ffbf53b /Swiften/Session/BasicSessionStream.cpp
parent7de0bdc001ab361b26dc50add7b48e49f87ac755 (diff)
downloadswift-940cb5e744564ec15b805a9e5388e1fa5c60d703.zip
swift-940cb5e744564ec15b805a9e5388e1fa5c60d703.tar.bz2
Renaming SessionStream::onError to SessionStream::onClosed.
Diffstat (limited to 'Swiften/Session/BasicSessionStream.cpp')
-rw-r--r--Swiften/Session/BasicSessionStream.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index 3f06315..5377e6c 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -43,7 +43,7 @@ BasicSessionStream::BasicSessionStream(
xmppLayer->onDataRead.connect(boost::bind(&BasicSessionStream::handleDataRead, this, _1));
xmppLayer->onWriteData.connect(boost::bind(&BasicSessionStream::handleDataWritten, this, _1));
- connection->onDisconnected.connect(boost::bind(&BasicSessionStream::handleConnectionError, this, _1));
+ connection->onDisconnected.connect(boost::bind(&BasicSessionStream::handleConnectionFinished, this, _1));
connectionLayer = new ConnectionLayer(connection);
streamStack = new StreamStack(xmppLayer, connectionLayer);
@@ -62,7 +62,7 @@ BasicSessionStream::~BasicSessionStream() {
delete whitespacePingLayer;
delete streamStack;
- connection->onDisconnected.disconnect(boost::bind(&BasicSessionStream::handleConnectionError, this, _1));
+ connection->onDisconnected.disconnect(boost::bind(&BasicSessionStream::handleConnectionFinished, this, _1));
delete connectionLayer;
xmppLayer->onStreamStart.disconnect(boost::bind(&BasicSessionStream::handleStreamStartReceived, this, _1));
@@ -100,7 +100,7 @@ void BasicSessionStream::addTLSEncryption() {
assert(available);
tlsLayer = new TLSLayer(tlsContextFactory);
if (hasTLSCertificate() && !tlsLayer->setClientCertificate(getTLSCertificate())) {
- onError(boost::shared_ptr<Error>(new Error(Error::InvalidTLSCertificateError)));
+ onClosed(boost::shared_ptr<Error>(new Error(Error::InvalidTLSCertificateError)));
}
else {
streamStack->addLayer(tlsLayer);
@@ -158,7 +158,7 @@ void BasicSessionStream::handleElementReceived(boost::shared_ptr<Element> elemen
void BasicSessionStream::handleXMPPError() {
available = false;
- onError(boost::shared_ptr<Error>(new Error(Error::ParseError)));
+ onClosed(boost::shared_ptr<Error>(new Error(Error::ParseError)));
}
void BasicSessionStream::handleTLSConnected() {
@@ -167,16 +167,19 @@ void BasicSessionStream::handleTLSConnected() {
void BasicSessionStream::handleTLSError() {
available = false;
- onError(boost::shared_ptr<Error>(new Error(Error::TLSError)));
+ onClosed(boost::shared_ptr<Error>(new Error(Error::TLSError)));
}
-void BasicSessionStream::handleConnectionError(const boost::optional<Connection::Error>& error) {
+void BasicSessionStream::handleConnectionFinished(const boost::optional<Connection::Error>& error) {
available = false;
if (error == Connection::ReadError) {
- onError(boost::shared_ptr<Error>(new Error(Error::ConnectionReadError)));
+ onClosed(boost::shared_ptr<Error>(new Error(Error::ConnectionReadError)));
+ }
+ else if (error) {
+ onClosed(boost::shared_ptr<Error>(new Error(Error::ConnectionWriteError)));
}
else {
- onError(boost::shared_ptr<Error>(new Error(Error::ConnectionWriteError)));
+ onClosed(boost::shared_ptr<Error>());
}
}