     handle ;
 
 : ssl-error-syscall ( ssl-handle -- event/f )
-    f >>connected drop
+    f >>connected
+    t >>terminated drop
     ERR_get_error {
         { -1 [
             errno { [ ECONNRESET = ] [ EPIPE = ] } 1||

        tri
    ] with-destructors ;

TUPLE: ssl-handle < disposable file handle connected ;

SYMBOL: default-secure-context



: maybe-handshake ( ssl-handle -- )
    dup connected>> [ drop ] [
        dup terminated>> [
            drop
        ] [
            [ [ do-ssl-accept ] with-timeout ]
            [ t swap connected<< ] bi
        ] if
    ] if ;

! Input ports
