From 3c789294b7e83e50b5eb3d14d8e64df411c4829a Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 8 Jan 2014 23:01:36 +0900 Subject: [PATCH] gnutls: Handle GNUTLS_E_INTERRUPTED as well as GNUTLS_E_AGAIN --- src/LibgnutlsTLSSession.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/LibgnutlsTLSSession.cc b/src/LibgnutlsTLSSession.cc index 7c9abfae..5cc78aa5 100644 --- a/src/LibgnutlsTLSSession.cc +++ b/src/LibgnutlsTLSSession.cc @@ -134,7 +134,7 @@ int GnuTLSSession::closeConnection() rv_ = gnutls_bye(sslSession_, GNUTLS_SHUT_WR); if(rv_ == GNUTLS_E_SUCCESS) { return TLS_ERR_OK; - } else if(rv_ == GNUTLS_E_AGAIN) { + } else if(rv_ == GNUTLS_E_AGAIN || rv_ == GNUTLS_E_INTERRUPTED) { return TLS_ERR_WOULDBLOCK; } else { return TLS_ERR_ERROR; @@ -155,7 +155,7 @@ ssize_t GnuTLSSession::writeData(const void* data, size_t len) ssize_t ret = rv_; rv_ = 0; return ret; - } else if(rv_ == GNUTLS_E_AGAIN) { + } else if(rv_ == GNUTLS_E_AGAIN || rv_ == GNUTLS_E_INTERRUPTED) { return TLS_ERR_WOULDBLOCK; } else { return TLS_ERR_ERROR; @@ -170,7 +170,7 @@ ssize_t GnuTLSSession::readData(void* data, size_t len) ssize_t ret = rv_; rv_ = 0; return ret; - } else if(rv_ == GNUTLS_E_AGAIN) { + } else if(rv_ == GNUTLS_E_AGAIN || rv_ == GNUTLS_E_INTERRUPTED) { return TLS_ERR_WOULDBLOCK; } else { return TLS_ERR_ERROR; @@ -183,7 +183,7 @@ int GnuTLSSession::tlsConnect(const std::string& hostname, handshakeErr = ""; rv_ = gnutls_handshake(sslSession_); if(rv_ < 0) { - if(rv_ == GNUTLS_E_AGAIN) { + if(rv_ == GNUTLS_E_AGAIN || rv_ == GNUTLS_E_INTERRUPTED) { return TLS_ERR_WOULDBLOCK; } else { return TLS_ERR_ERROR; @@ -282,7 +282,7 @@ int GnuTLSSession::tlsAccept() rv_ = gnutls_handshake(sslSession_); if(rv_ == GNUTLS_E_SUCCESS) { return TLS_ERR_OK; - } else if(rv_ == GNUTLS_E_AGAIN) { + } else if(rv_ == GNUTLS_E_AGAIN || rv_ == GNUTLS_E_INTERRUPTED) { return TLS_ERR_WOULDBLOCK; } else { return TLS_ERR_ERROR;