@@ -136,7 +136,7 @@ defmodule ExICE.ICEAgent do
136
136
stun_server
137
137
138
138
:error ->
139
- Logger . warn ( """
139
+ Logger . warning ( """
140
140
Couldn't parse STUN server URI: #{ inspect ( stun_server ) } . \
141
141
Ignoring.\
142
142
""" )
@@ -198,7 +198,7 @@ defmodule ExICE.ICEAgent do
198
198
{ :set_remote_credentials , ufrag , pwd } ,
199
199
% { remote_ufrag: ufrag , remote_pwd: pwd } = state
200
200
) do
201
- Logger . warn ( "Passed the same remote credentials to be set. Ignoring." )
201
+ Logger . warning ( "Passed the same remote credentials to be set. Ignoring." )
202
202
{ :noreply , state }
203
203
end
204
204
@@ -212,13 +212,13 @@ defmodule ExICE.ICEAgent do
212
212
213
213
@ impl true
214
214
def handle_cast ( :gather_candidates , % { gathering_state: :gathering } = state ) do
215
- Logger . warn ( "Can't gather candidates. Gathering already in progress. Ignoring." )
215
+ Logger . warning ( "Can't gather candidates. Gathering already in progress. Ignoring." )
216
216
{ :noreply , state }
217
217
end
218
218
219
219
@ impl true
220
220
def handle_cast ( :gather_candidates , % { gathering_state: :complete } = state ) do
221
- Logger . warn ( "Can't gather candidates. ICE restart needed. Ignoring." )
221
+ Logger . warning ( "Can't gather candidates. ICE restart needed. Ignoring." )
222
222
{ :noreply , state }
223
223
end
224
224
@@ -265,7 +265,7 @@ defmodule ExICE.ICEAgent do
265
265
266
266
@ impl true
267
267
def handle_cast ( { :add_remote_candidate , _remote_cand } , % { eoc: true } = state ) do
268
- Logger . warn ( "Received remote candidate after end-of-candidates. Ignoring." )
268
+ Logger . warning ( "Received remote candidate after end-of-candidates. Ignoring." )
269
269
{ :noreply , state }
270
270
end
271
271
@@ -282,7 +282,7 @@ defmodule ExICE.ICEAgent do
282
282
{ :noreply , state }
283
283
284
284
{ :error , reason } ->
285
- Logger . warn ( "Invalid remote candidate, reason: #{ inspect ( reason ) } . Ignoring." )
285
+ Logger . warning ( "Invalid remote candidate, reason: #{ inspect ( reason ) } . Ignoring." )
286
286
{ :noreply , state }
287
287
end
288
288
end
@@ -320,7 +320,7 @@ defmodule ExICE.ICEAgent do
320
320
321
321
@ impl true
322
322
def handle_cast ( { :send_data , _data } , % { state: ice_state } = state ) do
323
- Logger . warn ( """
323
+ Logger . warning ( """
324
324
Cannot send data in ICE state: #{ inspect ( ice_state ) } . \
325
325
Data can only be sent in state :connected or :completed. Ignoring.\
326
326
""" )
@@ -347,7 +347,7 @@ defmodule ExICE.ICEAgent do
347
347
348
348
@ impl true
349
349
def handle_info ( :ta_timeout , state ) when state . state in [ :completed , :failed ] do
350
- Logger . warn ( """
350
+ Logger . warning ( """
351
351
Ta timer fired in unexpected state: #{ state . state } .
352
352
Trying to update gathering and connection states.
353
353
""" )
@@ -419,7 +419,7 @@ defmodule ExICE.ICEAgent do
419
419
{ :noreply , state }
420
420
421
421
{ :error , reason } ->
422
- Logger . warn ( "Couldn't decode stun message: #{ inspect ( reason ) } " )
422
+ Logger . warning ( "Couldn't decode stun message: #{ inspect ( reason ) } " )
423
423
{ :noreply , state }
424
424
end
425
425
else
@@ -430,7 +430,7 @@ defmodule ExICE.ICEAgent do
430
430
431
431
@ impl true
432
432
def handle_info ( msg , state ) do
433
- Logger . warn ( "Got unexpected msg: #{ inspect ( msg ) } " )
433
+ Logger . warning ( "Got unexpected msg: #{ inspect ( msg ) } " )
434
434
{ :noreply , state }
435
435
end
436
436
@@ -572,15 +572,15 @@ defmodule ExICE.ICEAgent do
572
572
handle_gathering_transaction_response ( socket , src_ip , src_port , msg , state )
573
573
574
574
% Type { class: class , method: :binding } when is_response ( class ) ->
575
- Logger . warn ( """
575
+ Logger . warning ( """
576
576
Ignoring binding response with unknown t_id: #{ msg . transaction_id } .
577
577
Is it retransmission or we called ICE restart?
578
578
""" )
579
579
580
580
state
581
581
582
582
other ->
583
- Logger . warn ( """
583
+ Logger . warning ( """
584
584
Unknown msg from: #{ inspect ( { src_ip , src_port } ) } , on: #{ inspect ( socket_addr ) } , msg: #{ inspect ( other ) } \
585
585
""" )
586
586
@@ -746,7 +746,7 @@ defmodule ExICE.ICEAgent do
746
746
else
747
747
{ :ok , { socket_ip , socket_port } } = :inet . sockname ( socket )
748
748
749
- Logger . warn ( """
749
+ Logger . warning ( """
750
750
Ignoring conn check response, non-symmetric src and dst addresses.
751
751
Sent from: #{ inspect ( { conn_check_pair . local_cand . base_address , conn_check_pair . local_cand . base_port } ) } , \
752
752
to: #{ inspect ( { conn_check_pair . remote_cand . address , conn_check_pair . remote_cand . port } ) }
@@ -906,7 +906,7 @@ defmodule ExICE.ICEAgent do
906
906
# all checklists with the same foundation to Waiting.
907
907
defp add_valid_pair (
908
908
valid_pair ,
909
- _conn_check_pair ,
909
+ conn_check_pair ,
910
910
% CandidatePair { valid?: true } = checklist_pair ,
911
911
% { role: :controlling } = state
912
912
)
@@ -915,8 +915,14 @@ defmodule ExICE.ICEAgent do
915
915
# marked as valid so this cannot be our first conn check on it -
916
916
# this means that nominate? flag has to be set
917
917
true = checklist_pair . nominate?
918
+ conn_check_pair = % CandidatePair { conn_check_pair | state: :succeeded }
918
919
checklist_pair = % CandidatePair { checklist_pair | state: :succeeded }
919
- checklist = Map . replace! ( state . checklist , checklist_pair . id , checklist_pair )
920
+
921
+ checklist =
922
+ state . checklist
923
+ |> Map . replace! ( checklist_pair . id , checklist_pair )
924
+ |> Map . replace! ( conn_check_pair . id , conn_check_pair )
925
+
920
926
state = % { state | checklist: checklist }
921
927
{ checklist_pair . id , state }
922
928
end
@@ -931,7 +937,13 @@ defmodule ExICE.ICEAgent do
931
937
resulted from conn check on pair: #{ inspect ( conn_check_pair . id ) } \
932
938
""" )
933
939
934
- conn_check_pair = % CandidatePair { conn_check_pair | state: :succeeded , valid?: true }
940
+ conn_check_pair = % CandidatePair {
941
+ conn_check_pair
942
+ | succeeded_pair_id: conn_check_pair . id ,
943
+ discovered_pair_id: conn_check_pair . id ,
944
+ state: :succeeded ,
945
+ valid?: true
946
+ }
935
947
936
948
checklist = Map . replace! ( state . checklist , conn_check_pair . id , conn_check_pair )
937
949
@@ -946,8 +958,20 @@ defmodule ExICE.ICEAgent do
946
958
resulted from conn check on pair: #{ inspect ( conn_check_pair . id ) } \
947
959
""" )
948
960
949
- conn_check_pair = % CandidatePair { conn_check_pair | state: :succeeded }
950
- checklist_pair = % CandidatePair { checklist_pair | state: :succeeded , valid?: true }
961
+ conn_check_pair = % CandidatePair {
962
+ conn_check_pair
963
+ | discovered_pair_id: checklist_pair . id ,
964
+ succeeded_pair_id: conn_check_pair . id ,
965
+ state: :succeeded
966
+ }
967
+
968
+ checklist_pair = % CandidatePair {
969
+ checklist_pair
970
+ | discovered_pair_id: checklist_pair . id ,
971
+ succeeded_pair_id: conn_check_pair . id ,
972
+ state: :succeeded ,
973
+ valid?: true
974
+ }
951
975
952
976
checklist =
953
977
state . checklist
@@ -967,7 +991,18 @@ defmodule ExICE.ICEAgent do
967
991
968
992
Logger . debug ( "New valid pair: #{ inspect ( valid_pair . id ) } " )
969
993
970
- conn_check_pair = % CandidatePair { conn_check_pair | state: :succeeded }
994
+ conn_check_pair = % CandidatePair {
995
+ conn_check_pair
996
+ | discovered_pair_id: valid_pair . id ,
997
+ succeeded_pair_id: conn_check_pair . id ,
998
+ state: :succeeded
999
+ }
1000
+
1001
+ valid_pair = % CandidatePair {
1002
+ valid_pair
1003
+ | discovered_pair_id: valid_pair . id ,
1004
+ succeeded_pair_id: conn_check_pair . id
1005
+ }
971
1006
972
1007
checklist =
973
1008
state . checklist
@@ -1108,6 +1143,10 @@ defmodule ExICE.ICEAgent do
1108
1143
case Checklist . get_pair_for_nomination ( state . checklist ) do
1109
1144
% CandidatePair { } = pair ->
1110
1145
Logger . debug ( "Trying to nominate pair: #{ inspect ( pair . id ) } " )
1146
+ pair = % CandidatePair { pair | nominate?: true }
1147
+ put_in ( state , [ :checklist , pair . id ] , pair )
1148
+ state = % { state | nominating?: { true , pair . id } }
1149
+ pair = Map . fetch! ( state . checklist , pair . succeeded_pair_id )
1111
1150
pair = % CandidatePair { pair | state: :waiting , nominate?: true }
1112
1151
{ pair , state } = send_conn_check ( pair , state )
1113
1152
put_in ( state , [ :checklist , pair . id ] , pair )
0 commit comments