Skip to content

add close_notify as raw SSL_shutdown #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
===== Unreleased =====

* add Lwt_ssl.close_notify to issue one-way SSL shutdown (#2, @madroach)

===== 1.1.3 (2018-07-30) =====

* Upgrade from Jbuilder to Dune (3b5782c).
2 changes: 1 addition & 1 deletion lwt_ssl.opam
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ depends: [
"dune"
"lwt" {>= "3.0.0"}
"ocaml"
"ssl" {>= "0.5.0"}
"ssl" {>= "0.5.13"}
]

build: [
7 changes: 7 additions & 0 deletions src/lwt_ssl.ml
Original file line number Diff line number Diff line change
@@ -168,6 +168,13 @@ let ssl_shutdown (fd, s) =

let shutdown (fd, _) cmd = Lwt_unix.shutdown fd cmd

let close_notify = function
| (_, Plain) as s ->
shutdown s Unix.SHUTDOWN_SEND;
Lwt.return_true
| (fd, SSL s) ->
repeat_call fd (fun () -> Ssl.close_notify s)

let close (fd, _) = Lwt_unix.close fd

let abort (fd, _) = Lwt_unix.abort fd
1 change: 1 addition & 0 deletions src/lwt_ssl.mli
Original file line number Diff line number Diff line change
@@ -74,6 +74,7 @@ val close : socket -> unit Lwt.t
val in_channel_of_descr : ?buffer:Lwt_bytes.t -> socket -> Lwt_io.input_channel
val out_channel_of_descr : ?buffer:Lwt_bytes.t -> socket -> Lwt_io.output_channel

val close_notify : socket -> bool Lwt.t
val ssl_shutdown : socket -> unit Lwt.t

val abort : socket -> exn -> unit