@@ -139,7 +139,8 @@ defmodule ExDTLS do
139
139
140
140
`timeout` is a time in ms after which `handle_timeout/1` should be called.
141
141
"""
142
- @ spec do_handshake ( dtls ( ) ) :: { packets :: [ binary ( ) ] , timeout :: integer ( ) }
142
+ @ spec do_handshake ( dtls ( ) ) ::
143
+ { :ok , packets :: [ binary ( ) ] , timeout :: integer ( ) } | { :error , :closed }
143
144
defdelegate do_handshake ( dtls ) , to: Native
144
145
145
146
@ doc """
@@ -148,7 +149,7 @@ defmodule ExDTLS do
148
149
Generates encrypted packets that need to be passed to the second host.
149
150
"""
150
151
@ spec write_data ( dtls ( ) , data :: binary ( ) ) ::
151
- { :ok , packets :: [ binary ( ) ] } | { :error , :handshake_not_finished }
152
+ { :ok , packets :: [ binary ( ) ] } | { :error , :handshake_not_finished | :closed }
152
153
defdelegate write_data ( dtls , data ) , to: Native
153
154
154
155
@ doc """
@@ -172,7 +173,7 @@ defmodule ExDTLS do
172
173
remote_keying_material :: binary ( ) , protection_profile_t ( ) , packets :: [ binary ( ) ] }
173
174
| { :handshake_finished , local_keying_material :: binary ( ) ,
174
175
remote_keying_material :: binary ( ) , protection_profile_t ( ) }
175
- | { :error , :handshake_error | :peer_closed_for_writing }
176
+ | { :error , :handshake_error | :peer_closed_for_writing | :closed }
176
177
def handle_data ( dtls , packets ) do
177
178
case Native . handle_data ( dtls , packets ) do
178
179
{ :handshake_finished , lkm , rkm , protection_profile , [ ] } ->
@@ -192,7 +193,8 @@ defmodule ExDTLS do
192
193
193
194
If there is no timeout to handle, simple `{:ok, dtls()}` tuple is returned.
194
195
"""
195
- @ spec handle_timeout ( dtls ( ) ) :: :ok | { :retransmit , packets :: [ binary ( ) ] , timeout :: integer ( ) }
196
+ @ spec handle_timeout ( dtls ( ) ) ::
197
+ :ok | { :retransmit , packets :: [ binary ( ) ] , timeout :: integer ( ) } | { :error , :closed }
196
198
defdelegate handle_timeout ( dtls ) , to: Native
197
199
198
200
@ doc """
0 commit comments