diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-08 03:24:05 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-08 03:24:05 +0200 |
commit | ec21d1874e54cfb4ce2f0e91ba0310b378b60a4b (patch) | |
tree | 454ba4b442419bfb7ab3d67287918c7b44803b5a /ffd/send.c | |
parent | 26f5dc2ab09ed83380a374300b10a245f4c848f4 (diff) | |
download | ffd-ec21d1874e54cfb4ce2f0e91ba0310b378b60a4b.tar ffd-ec21d1874e54cfb4ce2f0e91ba0310b378b60a4b.zip |
Send triggered updates
Diffstat (limited to 'ffd/send.c')
-rw-r--r-- | ffd/send.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -176,7 +176,7 @@ static bool add_node_id(ffd_packet_t *packet, size_t max_len, ffd_node_id_t node return true; } -static bool add_update(ffd_packet_t *packet, size_t max_len, ffd_node_id_t *node_id, ffd_announce_t *announce, bool with_data) { +static bool add_update(ffd_packet_t *packet, size_t max_len, ffd_node_id_t *node_id, ffd_announce_t *announce, bool with_data, bool targetted) { if (announce->len && !announce->data) { /* incomplete announce, handle like non-existant announce */ return true; @@ -217,6 +217,9 @@ static bool add_update(ffd_packet_t *packet, size_t max_len, ffd_node_id_t *node if (ffd_is_metric_better(announce->metric, announce->feasibility_distance)) announce->feasibility_distance = announce->metric; + if (!targetted) + announce->last_metric = announce->metric.metric; + return true; } @@ -227,20 +230,20 @@ void ffd_send_update(ffd_iface_t *iface, ffd_neigh_t *neigh, ffd_announce_t *ann packet->len = 0; if (announce) { - add_update(packet, FFD_PACKET_MAX, NULL, announce, with_data); + add_update(packet, FFD_PACKET_MAX, NULL, announce, with_data, iface || neigh); } else { ffd_node_id_t node_id = FFD_NODE_ID_UNSPEC; ffd_announce_t *a; for (a = announce_list; a; a = a->next) { - if (!add_update(packet, FFD_PACKET_MAX, &node_id, a, with_data)) { + if (!add_update(packet, FFD_PACKET_MAX, &node_id, a, with_data, iface || neigh)) { send_any(iface, neigh, packet); node_id = FFD_NODE_ID_UNSPEC; packet->len = 0; - if (!add_update(packet, FFD_PACKET_MAX, &node_id, a, with_data)) { + if (!add_update(packet, FFD_PACKET_MAX, &node_id, a, with_data, iface || neigh)) { fprintf(stderr, "error: add_update failed\n"); return; } |