Added discard of unread appdata on explicit close.
This commit is contained in:
parent
252dba9149
commit
946f5bad76
1 changed files with 15 additions and 0 deletions
|
|
@ -1232,6 +1232,21 @@ void
|
||||||
br_ssl_engine_close(br_ssl_engine_context *cc)
|
br_ssl_engine_close(br_ssl_engine_context *cc)
|
||||||
{
|
{
|
||||||
if (!br_ssl_engine_closed(cc)) {
|
if (!br_ssl_engine_closed(cc)) {
|
||||||
|
/*
|
||||||
|
* If we are not already closed, then we need to
|
||||||
|
* initiate the closure. Once closing, any incoming
|
||||||
|
* application data is discarded; we should also discard
|
||||||
|
* application data which is alreayd there but has not
|
||||||
|
* been acknowledged by the application yet (this mimics
|
||||||
|
* usual semantics on BSD sockets: you cannot read()
|
||||||
|
* once you called close(), even if there was some
|
||||||
|
* unread data already buffered).
|
||||||
|
*/
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if (br_ssl_engine_recvapp_buf(cc, &len) != NULL && len != 0) {
|
||||||
|
br_ssl_engine_recvapp_ack(cc, len);
|
||||||
|
}
|
||||||
jump_handshake(cc, 1);
|
jump_handshake(cc, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue