aboutsummaryrefslogtreecommitdiffstats
path: root/src/security/sasl/SASLSocket.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2012-11-29 21:08:25 +0000
committerVincent Richard <[email protected]>2012-11-29 21:33:31 +0000
commit3e9e8c9265f722d294c0060e1ccf29695fa5d2eb (patch)
tree73bb20a0855fbb3cf880f042804f3aa4583e9e8d /src/security/sasl/SASLSocket.cpp
parentMerge pull request #14 from mabrand/fix-wincrypt (diff)
downloadvmime-3e9e8c9265f722d294c0060e1ccf29695fa5d2eb.tar.gz
vmime-3e9e8c9265f722d294c0060e1ccf29695fa5d2eb.zip
Better handling of SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE. Sockets on Windows platform are now non-blocking (thanks to Mehmet Bozkurt).
Diffstat (limited to 'src/security/sasl/SASLSocket.cpp')
-rw-r--r--src/security/sasl/SASLSocket.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/security/sasl/SASLSocket.cpp b/src/security/sasl/SASLSocket.cpp
index 28f5f6f6..531e4188 100644
--- a/src/security/sasl/SASLSocket.cpp
+++ b/src/security/sasl/SASLSocket.cpp
@@ -177,6 +177,40 @@ void SASLSocket::sendRaw(const char* buffer, const size_type count)
}
+SASLSocket::size_type SASLSocket::sendRawNonBlocking(const char* buffer, const size_type count)
+{
+ byte_t* output = 0;
+ int outputLen = 0;
+
+ m_session->getMechanism()->encode
+ (m_session, reinterpret_cast <const byte_t*>(buffer), count,
+ &output, &outputLen);
+
+ size_type bytesSent = 0;
+
+ try
+ {
+ bytesSent = m_wrapped->sendRawNonBlocking
+ (reinterpret_cast <const char*>(output), outputLen);
+ }
+ catch (...)
+ {
+ delete [] output;
+ throw;
+ }
+
+ delete [] output;
+
+ return bytesSent;
+}
+
+
+unsigned int SASLSocket::getStatus() const
+{
+ return m_wrapped->getStatus();
+}
+
+
} // sasl
} // security
} // vmime