-
Notifications
You must be signed in to change notification settings - Fork 4
Add close/1 #81
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
Add close/1 #81
Conversation
981e9a0
to
7d09c8a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #81 +/- ##
==========================================
+ Coverage 83.88% 84.75% +0.87%
==========================================
Files 25 25
Lines 1837 1870 +33
==========================================
+ Hits 1541 1585 +44
+ Misses 296 285 -11
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
lib/ex_ice/priv/ice_agent.ex
Outdated
@@ -455,7 +462,7 @@ defmodule ExICE.Priv.ICEAgent do | |||
end | |||
|
|||
@spec end_of_candidates(t()) :: t() | |||
def end_of_candidates(%__MODULE__{state: :failed} = ice_agent) do | |||
def end_of_candidates(%__MODULE__{state: state} = ice_agent) when state in [:failed, :closed] do | |||
Logger.debug("Can't set end-of-candidates flag in state failed. Ignoring.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logger.debug("Can't set end-of-candidates flag in state failed. Ignoring.") | |
Logger.debug("Can't set end-of-candidates flag in state #{state}. Ignoring.") |
test/priv/ice_agent_test.exs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would ask a test that checks if all public functions in the ice agent won't change state if :closed
Add
close/1
function.This function irreversibly closes ICE agent but does not terminate its process. Later calls to getters (e.g.
get_stats/1
) are still allowed but the agent can no longer be used to establish a connection.NOTE The best solution would be to modify ICE agent API to be similar to Erlang's :gen_udp API where, after closing a socket,
:gen_udp
functions return{:error, :closed}
tuple. This however, would require a lot of changes. Other incorrect actions e.g. setting remote credentials in a wrong state, are also ignored i.e. no error is returned. If we find this problematic, we will modify ICE agent API in the future.Related to: elixir-webrtc/ex_webrtc#218