summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-04-09 01:09:16 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-04-09 01:09:16 +0900
commit83b801a0a50af72f124a6b6ff3e740854d178876 (patch)
tree272695aaf71813118f4fc442b4e7bc2308d988d7
parentf9225db135682ee092d0b374cfff0f1041a41ccd (diff)
parent16876a53344a4d3d5224a480fc17811574339301 (diff)
Merge branch 'appletls-wantread' of https://github.com/nmaier/aria2 into nmaier-appletls-cred-kc
-rw-r--r--src/AppleTLSSession.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/AppleTLSSession.cc b/src/AppleTLSSession.cc
index 385c7df1..1e56cd30 100644
--- a/src/AppleTLSSession.cc
+++ b/src/AppleTLSSession.cc
@@ -422,17 +422,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)