nghttp: Close fd on disconnect

This commit is contained in:
Tatsuhiro Tsujikawa 2013-12-22 19:23:01 +09:00
parent c4539046be
commit 53271e1e52
1 changed files with 6 additions and 0 deletions

View File

@ -547,10 +547,12 @@ struct HttpClient {
void disconnect() void disconnect()
{ {
int fd = -1;
state = STATE_IDLE; state = STATE_IDLE;
nghttp2_session_del(session); nghttp2_session_del(session);
session = nullptr; session = nullptr;
if(ssl) { if(ssl) {
fd = SSL_get_fd(ssl);
SSL_shutdown(ssl); SSL_shutdown(ssl);
} }
if(bev) { if(bev) {
@ -570,6 +572,10 @@ struct HttpClient {
SSL_free(ssl); SSL_free(ssl);
ssl = nullptr; ssl = nullptr;
} }
if(fd != -1) {
shutdown(fd, SHUT_WR);
close(fd);
}
} }
int on_upgrade_connect() int on_upgrade_connect()