Skip to content

Commit

Permalink
tls-eio: fix handle_tls
Browse files Browse the repository at this point in the history
  • Loading branch information
bikallem committed Dec 14, 2022
1 parent 2b084f9 commit eac6177
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions eio/tls_eio.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ module Raw = struct
match Tls.Engine.handle_tls t.tls data with
| Ok ( state, `Response resp, `Data application_data ) ->
begin match state with
| `Ok tls ->
t.tls <- tls ;
Option.iter (write_t t) resp ;
Eio.Mutex.unlock t.mutex ;
application_data
| `Ok tls -> t.tls <- tls
| `Eof ->
(* received "close_notify" alert from peer so shutdown receving data
from the peer socket. https://www.rfc-editor.org/rfc/rfc8446#section-6.1 *)
Eio.Flow.shutdown t.flow `Receive ;
None
from the peer socket. https://www.rfc-editor.org/rfc/rfc8446#section-6.1 *)
Eio.Flow.shutdown t.flow `Receive
| `Alert a -> raise (Tls_alert a)
end
end ;
Option.iter (write_t t) resp ;
Eio.Mutex.unlock t.mutex ;
application_data
| Error (failure, `Response resp) ->
write_t t resp ;
raise (Tls_failure failure)
Expand Down

0 comments on commit eac6177

Please sign in to comment.