AppleTLS: Fixup checkDirection() to return WANT_READ by default

pull/65/head
Nils Maier 2013-04-08 17:09:32 +02:00
parent 89cf6c0468
commit 16876a5334
1 changed files with 9 additions and 4 deletions

View File

@ -366,17 +366,22 @@ int AppleTLSSession::closeConnection()
}
int AppleTLSSession::checkDirection() {
if (writeBuffered_) {
return TLS_WANT_WRITE;
}
// See: https://github.com/tatsuhiro-t/aria2/pull/61#issuecomment-16051793
if (state_ == st_connected) {
// Need to check read first, as SocketCore kinda expects this
size_t buffered;
lastError_ = SSLGetBufferedReadSize(sslCtx_, &buffered);
if (lastError_ == noErr && buffered) {
return TLS_WANT_READ;
}
}
return 0;
if (writeBuffered_) {
return TLS_WANT_WRITE;
}
// Default to WANT_READ, as SocketCore kinda expects this
return TLS_WANT_READ;
}
ssize_t AppleTLSSession::writeData(const void* data, size_t len)