@@ -285,6 +285,11 @@ defmodule ExICE.Priv.ICEAgent do
285
285
{ :ok , sockets } = Gatherer . open_sockets ( ice_agent . gatherer )
286
286
host_cands = Gatherer . gather_host_candidates ( ice_agent . gatherer , sockets )
287
287
288
+ ice_agent =
289
+ Enum . reduce ( host_cands , ice_agent , fn host_cand , ice_agent ->
290
+ add_local_cand ( ice_agent , host_cand )
291
+ end )
292
+
288
293
for % cand_mod { } = cand <- host_cands do
289
294
notify ( ice_agent . on_new_candidate , { :new_candidate , cand_mod . marshal ( cand ) } )
290
295
end
@@ -297,12 +302,9 @@ defmodule ExICE.Priv.ICEAgent do
297
302
298
303
gathering_transactions = Map . merge ( srflx_gathering_transactions , relay_gathering_transactions )
299
304
300
- local_cands = Map . new ( host_cands , fn cand -> { cand . base . id , cand } end )
301
-
302
305
% {
303
306
ice_agent
304
307
| sockets: sockets ,
305
- local_cands: local_cands ,
306
308
gathering_transactions: gathering_transactions
307
309
}
308
310
|> update_gathering_state ( )
@@ -787,7 +789,7 @@ defmodule ExICE.Priv.ICEAgent do
787
789
Logger . debug ( """
788
790
Couldn't find #{ type } candidate for:
789
791
socket: #{ inspect ( socket ) }
790
- src address: #{ inspect ( { src_ip , src_port } ) } .
792
+ src address: #{ inspect ( { src_ip , src_port } ) } .
791
793
And this is not a STUN message. Ignoring.
792
794
""" )
793
795
@@ -1091,7 +1093,7 @@ defmodule ExICE.Priv.ICEAgent do
1091
1093
{ :new_candidate , Candidate.Relay . marshal ( relay_cand ) }
1092
1094
)
1093
1095
1094
- add_relay_cand ( ice_agent , relay_cand )
1096
+ add_local_cand ( ice_agent , relay_cand )
1095
1097
1096
1098
{ :send , turn_addr , data , client } ->
1097
1099
tr = % { tr | client: client }
@@ -1186,17 +1188,17 @@ defmodule ExICE.Priv.ICEAgent do
1186
1188
}
1187
1189
end
1188
1190
1189
- defp add_relay_cand ( ice_agent , relay_cand ) do
1190
- ice_agent = put_in ( ice_agent . local_cands [ relay_cand . base . id ] , relay_cand )
1191
+ defp add_local_cand ( ice_agent , local_cand ) do
1192
+ ice_agent = put_in ( ice_agent . local_cands [ local_cand . base . id ] , local_cand )
1191
1193
1192
- remote_cands = get_matching_candidates_local ( Map . values ( ice_agent . remote_cands ) , relay_cand )
1194
+ remote_cands = get_matching_candidates_local ( Map . values ( ice_agent . remote_cands ) , local_cand )
1193
1195
1194
1196
checklist_foundations = get_foundations ( ice_agent )
1195
1197
1196
1198
new_pairs =
1197
1199
for remote_cand <- remote_cands , into: % { } do
1198
- pair_state = get_pair_state ( relay_cand , remote_cand , checklist_foundations )
1199
- pair = CandidatePair . new ( relay_cand , remote_cand , ice_agent . role , pair_state )
1200
+ pair_state = get_pair_state ( local_cand , remote_cand , checklist_foundations )
1201
+ pair = CandidatePair . new ( local_cand , remote_cand , ice_agent . role , pair_state )
1200
1202
{ pair . id , pair }
1201
1203
end
1202
1204
0 commit comments