Merge pull request #1107 from aria2/wintls-error

wintls: Don't log writeData error in closing state
pull/1113/head
Tatsuhiro Tsujikawa 2018-01-08 15:57:53 +09:00 committed by GitHub
commit d6a6b3b28a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -386,8 +386,16 @@ ssize_t WinTLSSession::writeData(const void* data, size_t len)
static_cast<char*>(sendRecordBuffers_[1].pvBuffer));
status_ = ::EncryptMessage(&handle_, 0, &desc, 0);
if (status_ != SEC_E_OK) {
A2_LOG_ERROR(fmt("WinTLS: Failed to encrypt a message! %s",
getLastErrorString().c_str()));
if (state_ != st_closing) {
A2_LOG_ERROR(fmt("WinTLS: Failed to encrypt a message! %s",
getLastErrorString().c_str()));
} else {
// On closing state, don't log this message in error level
// because it seems that the encryption tends to fail in that
// state.
A2_LOG_DEBUG(fmt("WinTLS: Failed to encrypt a message! %s",
getLastErrorString().c_str()));
}
state_ = st_error;
return TLS_ERR_ERROR;
}