Allow an endpoint to read the alert data before closing the socket
authorMatt Caswell <matt@openssl.org>
Mon, 4 Sep 2017 10:20:27 +0000 (11:20 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 8 Sep 2017 12:18:45 +0000 (13:18 +0100)
commit389058f8a02641edc1847f84237efe757f836d03
tree67f03ebf66e09d785db9cedaee64e546ee9a1cc7
parent4ea5f53d7c6364d3d91539258d8aeb6e9a2e4c93
Allow an endpoint to read the alert data before closing the socket

If an alert gets sent and then we close the connection immediately with
data still in the input buffer then a TCP-RST gets sent. Some OSs
immediately abandon data in their input buffer if a TCP-RST is received -
meaning the alert data itself gets ditched. Sending a TCP-FIN before the
TCP-RST seems to avoid this.

This was causing test failures in MSYS2 builds.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/4333)

(cherry picked from commit bac6abe18d28373e0d2d0666c411020404197337)
apps/s_socket.c