diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-03-23 11:54:03 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-03-23 11:54:03 (GMT) |
commit | 846c4b9d2e7ec3214a3b13bdbbce77f70fede515 (patch) | |
tree | 579bf6be3e266c8e28a7469e7547ac88fa9af3fc /Swiften/Session/BasicSessionStream.cpp | |
parent | 8ccdfd958ba1e7afbeb8c5893c12f09046cb8892 (diff) | |
download | swift-contrib-846c4b9d2e7ec3214a3b13bdbbce77f70fede515.zip swift-contrib-846c4b9d2e7ec3214a3b13bdbbce77f70fede515.tar.bz2 |
Allow TLS errors to bubble further up the stackks/tlserrors
Diffstat (limited to 'Swiften/Session/BasicSessionStream.cpp')
-rw-r--r-- | Swiften/Session/BasicSessionStream.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp index f50c5d5..b49ffc9 100644 --- a/Swiften/Session/BasicSessionStream.cpp +++ b/Swiften/Session/BasicSessionStream.cpp @@ -111,11 +111,11 @@ void BasicSessionStream::addTLSEncryption() { assert(available); tlsLayer = new TLSLayer(tlsContextFactory); if (hasTLSCertificate() && !tlsLayer->setClientCertificate(getTLSCertificate())) { - onClosed(boost::make_shared<Error>(Error::InvalidTLSCertificateError)); + onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::InvalidTLSCertificateError)); } else { streamStack->addLayer(tlsLayer); - tlsLayer->onError.connect(boost::bind(&BasicSessionStream::handleTLSError, this)); + tlsLayer->onError.connect(boost::bind(&BasicSessionStream::handleTLSError, this, _1)); tlsLayer->onConnected.connect(boost::bind(&BasicSessionStream::handleTLSConnected, this)); tlsLayer->connect(); } @@ -173,28 +173,28 @@ void BasicSessionStream::handleElementReceived(boost::shared_ptr<Element> elemen void BasicSessionStream::handleXMPPError() { available = false; - onClosed(boost::make_shared<Error>(Error::ParseError)); + onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::ParseError)); } void BasicSessionStream::handleTLSConnected() { onTLSEncrypted(); } -void BasicSessionStream::handleTLSError() { +void BasicSessionStream::handleTLSError(boost::shared_ptr<TLSError> error) { available = false; - onClosed(boost::make_shared<Error>(Error::TLSError)); + onClosed(error); } void BasicSessionStream::handleConnectionFinished(const boost::optional<Connection::Error>& error) { available = false; if (error == Connection::ReadError) { - onClosed(boost::make_shared<Error>(Error::ConnectionReadError)); + onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::ConnectionReadError)); } else if (error) { - onClosed(boost::make_shared<Error>(Error::ConnectionWriteError)); + onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::ConnectionWriteError)); } else { - onClosed(boost::shared_ptr<Error>()); + onClosed(boost::shared_ptr<SessionStreamError>()); } } |