asyncnet, net: don't attempt SSL_shutdown if a fatal error occurred (#15066)

* asyncnet, net: don't attempt SSL_shutdown if a fatal error occurred

Per TLS standard and SSL_shutdown(3ssl). This should prevent errors
coming from a close() after a bad event (ie. the other end of the pipe
is closed before shutdown can be negotiated).

Ref #9867

* tssl: try sending until an error occur

* tssl: cleanup

* tssl: actually run the test

I forgot to make the test run :P

* tssl: run the test on ARC, maybe then it'll be happy

* tssl: turns off ARC, switch tlsEmulation on for freebsd

* tssl: document why tlsEmulation is employed

* net: move SafeDisconn handling logic to socketError
This commit is contained in:
alaviss 2020-07-29 22:35:02 +00:00 • committed by GitHub
commit 20315637aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 120 additions and 34 deletions

5
tests/stdlib/tssl.nims Normal file
View file

@ -0,0 +1,5 @@
--threads:on
--d:ssl
when defined(freebsd):
# See https://github.com/nim-lang/Nim/pull/15066#issuecomment-665541265
--tlsEmulation:off