diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-01-22 13:31:54 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-01-22 13:31:54 (GMT) |
commit | 940cb5e744564ec15b805a9e5388e1fa5c60d703 (patch) | |
tree | 9c5ed10128c5869c99dbeacc251234802ffbf53b /Swiften/Session | |
parent | 7de0bdc001ab361b26dc50add7b48e49f87ac755 (diff) | |
download | swift-940cb5e744564ec15b805a9e5388e1fa5c60d703.zip swift-940cb5e744564ec15b805a9e5388e1fa5c60d703.tar.bz2 |
Renaming SessionStream::onError to SessionStream::onClosed.
Diffstat (limited to 'Swiften/Session')
-rw-r--r-- | Swiften/Session/BasicSessionStream.cpp | 19 | ||||
-rw-r--r-- | Swiften/Session/BasicSessionStream.h | 2 | ||||
-rw-r--r-- | Swiften/Session/SessionStream.h | 2 |
3 files changed, 13 insertions, 10 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>()); } } diff --git a/Swiften/Session/BasicSessionStream.h b/Swiften/Session/BasicSessionStream.h index 35b5481..330db9d 100644 --- a/Swiften/Session/BasicSessionStream.h +++ b/Swiften/Session/BasicSessionStream.h @@ -56,7 +56,7 @@ namespace Swift { virtual void resetXMPPParser(); private: - void handleConnectionError(const boost::optional<Connection::Error>& error); + void handleConnectionFinished(const boost::optional<Connection::Error>& error); void handleXMPPError(); void handleTLSConnected(); void handleTLSError(); diff --git a/Swiften/Session/SessionStream.h b/Swiften/Session/SessionStream.h index d3d3ebb..55082f4 100644 --- a/Swiften/Session/SessionStream.h +++ b/Swiften/Session/SessionStream.h @@ -67,7 +67,7 @@ namespace Swift { boost::signal<void (const ProtocolHeader&)> onStreamStartReceived; boost::signal<void (boost::shared_ptr<Element>)> onElementReceived; - boost::signal<void (boost::shared_ptr<Error>)> onError; + boost::signal<void (boost::shared_ptr<Error>)> onClosed; boost::signal<void ()> onTLSEncrypted; boost::signal<void (const String&)> onDataRead; boost::signal<void (const String&)> onDataWritten; |