]> gitweb.factorcode.org Git - factor.git/commitdiff
openssl: Rename (ssl-error) to throw-ssl-error and set
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 20 Dec 2021 16:53:22 +0000 (10:53 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 20 Dec 2021 16:53:22 +0000 (10:53 -0600)
terminated/connected when SSL_ERROR_ZERO_RETURN

Related to #2487

basis/io/sockets/secure/openssl/openssl.factor
basis/openssl/openssl.factor

index f054e17d993a2b34ce3c21ebda49e0cff1c475a8..daa9ebb6f19059bde09040291a2ad607c82e2150 100644 (file)
@@ -294,8 +294,10 @@ PRIVATE>
         { SSL_ERROR_WANT_READ [ drop +input+ ] }
         { SSL_ERROR_WANT_WRITE [ drop +output+ ] }
         { SSL_ERROR_SYSCALL [ ssl-error-syscall ] }
-        { SSL_ERROR_SSL [ drop (ssl-error) ] }
-        { SSL_ERROR_ZERO_RETURN [ drop f ] }
+        { SSL_ERROR_SSL [ drop throw-ssl-error ] }
+        ! https://stackoverflow.com/questions/50223224/ssl-read-returns-ssl-error-zero-return-but-err-get-error-is-0
+        ! we got disconnected
+        { SSL_ERROR_ZERO_RETURN [ t >>terminated f >>connected drop f ] }
         { SSL_ERROR_WANT_ACCEPT [ drop +input+ ] }
     } case ;
 
index 8d2e6b9e8a2d03acaf85cca5fa30b16f3edded6b..de15c2c97a7668160883ac00b2b6d8347f06af39 100644 (file)
@@ -16,11 +16,11 @@ SINGLETON: openssl
 : ssl-error-string ( -- string )
     ERR_get_error (ssl-error-string) ;
 
-: (ssl-error) ( -- * )
+: throw-ssl-error ( -- * )
     ssl-error-string throw ;
 
 : ssl-error ( obj -- )
-    { f 0 } member? [ (ssl-error) ] when ;
+    { f 0 } member? [ throw-ssl-error ] when ;
 
 : init-old-api ( -- )
     SSL_library_init ssl-error