Skip to content

Commit

Permalink
Ensure that we initialise the purgeability of peer structures when we…
Browse files Browse the repository at this point in the history
… allocate them
  • Loading branch information
hamishcoleman committed Oct 24, 2023
1 parent e9659e3 commit 1a598fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/edge_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ static void register_with_new_peer (n2n_edge_t *eee,
scan->sock = *peer;
scan->timeout = eee->conf.register_interval; /* TODO: should correspond to the peer supernode registration timeout */
scan->last_valid_time_stamp = initial_time_stamp();
scan->purgeable = true;
if(via_multicast)
scan->local = 1;

Expand Down Expand Up @@ -1903,6 +1904,7 @@ static int check_query_peer_info (n2n_edge_t *eee, time_t now, n2n_mac_t mac) {
scan->timeout = eee->conf.register_interval; /* TODO: should correspond to the peer supernode registration timeout */
scan->last_seen = now; /* Don't change this it marks the pending peer for removal. */
scan->last_valid_time_stamp = initial_time_stamp();
scan->purgeable = true;

HASH_ADD_PEER(eee->pending_peers, scan);
}
Expand Down
1 change: 1 addition & 0 deletions src/n2n.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ struct peer_info* add_sn_to_list_by_mac_or_sock (struct peer_info **sn_list, n2n
if(peer) {
sn_selection_criterion_default(&(peer->selection_criterion));
peer->last_valid_time_stamp = initial_time_stamp();
peer->purgeable = true;
memcpy(&(peer->sock), sock, sizeof(n2n_sock_t));
memcpy(peer->mac_addr, mac, sizeof(n2n_mac_t));
HASH_ADD_PEER(*sn_list, peer);
Expand Down

0 comments on commit 1a598fa

Please sign in to comment.