nghttpx: Fix assertion failure on TLS handshake

This commit is contained in:
Tatsuhiro Tsujikawa 2015-09-15 23:24:30 +09:00
parent 991352d201
commit 4aaf111c58
1 changed files with 8 additions and 1 deletions

View File

@ -146,7 +146,14 @@ int shrpx_bio_write(BIO *b, const char *buf, int len) {
if (conn->tls.initial_handshake_done) {
// After handshake finished, send |buf| of length |len| to the
// socket directly.
assert(wbuf.rleft() == 0);
// Only when TLS session was prematurely ended before server sent
// all handshake message, this condition is true. This could be
// alert from SSL_shutdown(). Since connection is already down,
// just return error.
if (wbuf.rleft()) {
return -1;
}
auto nwrite = conn->write_clear(buf, len);
if (nwrite < 0) {
return -1;