@@ -8,50 +8,6 @@ defmodule ExICE.ControlledHandler do
8
8
alias ExICE . { CandidatePair , Checklist , ICEAgent }
9
9
alias ExICE.Attribute.UseCandidate
10
10
11
- @ impl true
12
- def handle_checklist ( state ) do
13
- case Checklist . get_next_pair ( state . checklist ) do
14
- % CandidatePair { } = pair ->
15
- Logger . debug ( "Sending conn check on pair: #{ inspect ( pair . id ) } " )
16
- { pair , state } = ICEAgent . send_conn_check ( pair , state )
17
- put_in ( state , [ :checklist , pair . id ] , pair )
18
-
19
- nil ->
20
- cond do
21
- # if we knew, the other side uses regular nomination
22
- # we would move to the completed state as soon as we
23
- # received nomination request but because we don't
24
- # know wheter the other side uses regular or aggressive
25
- # nomination we have to be prepared for the case
26
- # where there is selected pair and we are not in the completed
27
- Checklist . finished? ( state . checklist ) and state . gathering_state == :complete and
28
- state . selected_pair != nil and state . eoc == true ->
29
- Logger . debug ( """
30
- Finished all conn checks, there won't be any further local or remote candidates
31
- and we have selected pair. Changing connection state to completed.
32
- """ )
33
-
34
- ICEAgent . change_connection_state ( :completed , state )
35
-
36
- # if we know, there are won't be any remote (eoc==true) and
37
- # local (gathering_state==complete) candidates, we finished
38
- # performing all conn checks and there is no selected or valid pair
39
- # (state.state==checking), move to the failed state
40
- Checklist . finished? ( state . checklist ) and state . gathering_state == :complete and
41
- state . eoc == true and state . state == :checking ->
42
- Logger . debug ( """
43
- Finished all conn checks, there won't be any further local or remote candidates
44
- and we don't have any valid or selected pair. Changing connection state to failed.
45
- """ )
46
-
47
- ICEAgent . change_connection_state ( :failed , state )
48
-
49
- true ->
50
- state
51
- end
52
- end
53
- end
54
-
55
11
@ impl true
56
12
def handle_conn_check_request ( state , pair , msg , nil , key ) do
57
13
ICEAgent . send_binding_success_response ( pair , msg , key )
@@ -94,6 +50,10 @@ defmodule ExICE.ControlledHandler do
94
50
95
51
% CandidatePair { } = pair ->
96
52
if pair . state == :succeeded do
53
+ # FIXME we should check against valid? flag
54
+ # it's possible to have to pairs: one with state succeeded
55
+ # and flag valid? set to false, and the other one with state
56
+ # succeeded and flag valid? set to true
97
57
# TODO should we call this selected or nominated pair
98
58
Logger . debug ( "Nomination request on valid pair: #{ pair . id } ." )
99
59
update_nominated_flag ( state , pair . id , true )
@@ -139,27 +99,6 @@ defmodule ExICE.ControlledHandler do
139
99
state
140
100
end
141
101
142
- checklist_finished? =
143
- not ( Checklist . in_progress? ( state . checklist ) or Checklist . waiting? ( state . checklist ) )
144
-
145
- state =
146
- if state . eoc and checklist_finished? and state . gathering_state == :complete and
147
- state . state != :completed do
148
- # Assuming the controlling side uses regulard nomination,
149
- # the controlled side could move to the completed
150
- # state as soon as it receives nomination request (or after
151
- # successful triggered check caused by nomination request).
152
- # However, to be compatible with the older RFC's aggresive
153
- # nomination, we wait for the end-of-candidates indication
154
- # and checklist to be finished.
155
- # This also means, that if the other side never sets eoc,
156
- # we will never move to the completed state.
157
- # This seems to be compliant with libwebrtc.
158
- ICEAgent . change_connection_state ( :completed , state )
159
- else
160
- state
161
- end
162
-
163
102
checklist =
164
103
Map . update! ( state . checklist , pair_id , fn pair ->
165
104
% CandidatePair { pair | nominate?: false , nominated?: true }
0 commit comments