Skip to content

Commit 5c771be

Browse files
Merge branch 'master' of https://bearssl.org/git/BearSSL
2 parents 0645c68 + acc70b1 commit 5c771be

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/ssl/ssl_engine.c

+15
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,21 @@ void
12321232
br_ssl_engine_close(br_ssl_engine_context *cc)
12331233
{
12341234
if (!br_ssl_engine_closed(cc)) {
1235+
/*
1236+
* If we are not already closed, then we need to
1237+
* initiate the closure. Once closing, any incoming
1238+
* application data is discarded; we should also discard
1239+
* application data which is already there but has not
1240+
* been acknowledged by the application yet (this mimics
1241+
* usual semantics on BSD sockets: you cannot read()
1242+
* once you called close(), even if there was some
1243+
* unread data already buffered).
1244+
*/
1245+
size_t len;
1246+
1247+
if (br_ssl_engine_recvapp_buf(cc, &len) != NULL && len != 0) {
1248+
br_ssl_engine_recvapp_ack(cc, len);
1249+
}
12351250
jump_handshake(cc, 1);
12361251
}
12371252
}

0 commit comments

Comments
 (0)