@@ -199,6 +199,12 @@ impl Network {
199
199
}
200
200
201
201
self . link_weights = link_weights;
202
+ tracing:: info!(
203
+ "{} Update link weights to {:?}" ,
204
+ & self . name,
205
+ & self . link_weights
206
+ ) ;
207
+
202
208
if dests_to_update. is_empty ( )
203
209
|| !( self . full_linkstate || self . router_peers_failover_brokering )
204
210
{
@@ -411,11 +417,8 @@ impl Network {
411
417
} ) )
412
418
}
413
419
414
- fn get_default_link_weight_to ( & self , idx : NodeIndex ) -> LinkEdgeWeight {
415
- self . link_weights
416
- . get ( & self . graph [ idx] . zid )
417
- . copied ( )
418
- . unwrap_or_default ( )
420
+ fn get_default_link_weight_to ( & self , zid : & ZenohIdProto ) -> LinkEdgeWeight {
421
+ self . link_weights . get ( zid) . copied ( ) . unwrap_or_default ( )
419
422
}
420
423
421
424
fn update_edge ( & mut self , idx1 : NodeIndex , idx2 : NodeIndex ) {
@@ -837,17 +840,23 @@ impl Network {
837
840
}
838
841
} ;
839
842
840
- let link_weight = self . get_default_link_weight_to ( idx) ;
843
+ let link_weight = self . get_default_link_weight_to ( & zid) ;
844
+ self . graph [ self . idx ] . links . insert ( zid, link_weight) ;
845
+ self . graph [ self . idx ] . sn += 1 ;
846
+
841
847
if self . full_linkstate
842
848
&& self . graph [ idx]
843
849
. links
844
850
. contains_key ( & self . graph [ self . idx ] . zid )
845
851
{
846
852
self . update_edge ( self . idx , idx) ;
847
- tracing:: trace!( "Update edge (link) {} {}" , self . graph[ self . idx] . zid, zid) ;
853
+ tracing:: trace!(
854
+ "{} Update edge (link) {} {}" ,
855
+ & self . name,
856
+ self . graph[ self . idx] . zid,
857
+ zid
858
+ ) ;
848
859
}
849
- self . graph [ self . idx ] . links . insert ( zid, link_weight) ;
850
- self . graph [ self . idx ] . sn += 1 ;
851
860
852
861
// Send updated self linkstate on all existing links except new one
853
862
self . links
0 commit comments