]> gitweb.factorcode.org Git - factor.git/commitdiff
io.sockets.secure.openssl: undo some error handling that makes factorcode hang
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 26 Dec 2021 16:59:09 +0000 (10:59 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 26 Dec 2021 16:59:09 +0000 (10:59 -0600)
partially reverting some of bfaa2c2cbd6f5123a8f4118a50fac1336d37aa4c

Related to https://github.com/factor/factor/issues/2487

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

index ac3e0d179ef47b316fe3b10663198a8e102ebe7b..9d56fab25d1a4b3505a72ca270b783824e6bea43 100644 (file)
@@ -187,7 +187,7 @@ M: openssl-context dispose*
         tri
     ] with-destructors ;
 
-TUPLE: ssl-handle < disposable file handle connected terminated ;
+TUPLE: ssl-handle < disposable file handle connected ;
 
 SYMBOL: default-secure-context
 
@@ -275,8 +275,7 @@ PRIVATE>
     handle ;
 
 : ssl-error-syscall ( ssl-handle -- event/f )
-    f >>connected
-    t >>terminated drop
+    f >>connected drop
     ERR_get_error {
         { -1 [
             errno { [ ECONNRESET = ] [ EPIPE = ] } 1||
@@ -297,7 +296,7 @@ PRIVATE>
         { 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_ZERO_RETURN [ drop f ] }
         { SSL_ERROR_WANT_ACCEPT [ drop +input+ ] }
     } case ;
 
@@ -311,12 +310,8 @@ PRIVATE>
 
 : maybe-handshake ( ssl-handle -- )
     dup connected>> [ drop ] [
-        dup terminated>> [
-            drop
-        ] [
-            [ [ do-ssl-accept ] with-timeout ]
-            [ t swap connected<< ] bi
-        ] if
+        [ [ do-ssl-accept ] with-timeout ]
+        [ t swap connected<< ] bi
     ] if ;
 
 ! Input ports