Skip to content

Commit fb6d85d

Browse files
committed
Fix typespecs
1 parent 5a9904d commit fb6d85d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/ex_dtls.ex

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ defmodule ExDTLS do
139139
140140
`timeout` is a time in ms after which `handle_timeout/1` should be called.
141141
"""
142-
@spec do_handshake(dtls()) :: {packets :: [binary()], timeout :: integer()}
142+
@spec do_handshake(dtls()) ::
143+
{:ok, packets :: [binary()], timeout :: integer()} | {:error, :closed}
143144
defdelegate do_handshake(dtls), to: Native
144145

145146
@doc """
@@ -148,7 +149,7 @@ defmodule ExDTLS do
148149
Generates encrypted packets that need to be passed to the second host.
149150
"""
150151
@spec write_data(dtls(), data :: binary()) ::
151-
{:ok, packets :: [binary()]} | {:error, :handshake_not_finished}
152+
{:ok, packets :: [binary()]} | {:error, :handshake_not_finished | :closed}
152153
defdelegate write_data(dtls, data), to: Native
153154

154155
@doc """
@@ -172,7 +173,7 @@ defmodule ExDTLS do
172173
remote_keying_material :: binary(), protection_profile_t(), packets :: [binary()]}
173174
| {:handshake_finished, local_keying_material :: binary(),
174175
remote_keying_material :: binary(), protection_profile_t()}
175-
| {:error, :handshake_error | :peer_closed_for_writing}
176+
| {:error, :handshake_error | :peer_closed_for_writing | :closed}
176177
def handle_data(dtls, packets) do
177178
case Native.handle_data(dtls, packets) do
178179
{:handshake_finished, lkm, rkm, protection_profile, []} ->
@@ -192,7 +193,8 @@ defmodule ExDTLS do
192193
193194
If there is no timeout to handle, simple `{:ok, dtls()}` tuple is returned.
194195
"""
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}
196198
defdelegate handle_timeout(dtls), to: Native
197199

198200
@doc """

0 commit comments

Comments
 (0)