diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-02 23:13:00 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-02 23:13:00 +0200 |
commit | 4a4482017978e360a0ae1ca7645e5e9e084c92b4 (patch) | |
tree | 2805b517bff7182ab3b180c6d68bca789df036ae /ffd/neigh.c | |
parent | e03169f8594f890162be16f72ea7000f802a252e (diff) | |
download | ffd-4a4482017978e360a0ae1ca7645e5e9e084c92b4.tar ffd-4a4482017978e360a0ae1ca7645e5e9e084c92b4.zip |
Add data structures to store announcements and partly implement updates
Diffstat (limited to 'ffd/neigh.c')
-rw-r--r-- | ffd/neigh.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ffd/neigh.c b/ffd/neigh.c index 6cfd5e8..9788d3f 100644 --- a/ffd/neigh.c +++ b/ffd/neigh.c @@ -50,6 +50,9 @@ void ffd_neigh_free_list(ffd_neigh_t *neigh) { } uint16_t ffd_neigh_get_rxcost(const ffd_neigh_t *neigh) { + if (!neigh->hello_log || !neigh->hello_interval) + return 0xffff; + int timediff = timespec_diff(&now, &neigh->last_hello)/10; int shift = (timediff - neigh->hello_interval/2)/neigh->hello_interval; int received = __builtin_popcount(neigh->hello_log << shift); @@ -74,5 +77,5 @@ uint16_t ffd_neigh_get_cost(const ffd_neigh_t *neigh) { } void ffd_neigh_reset(ffd_iface_t *iface, ffd_neigh_t *neigh) { - ffd_send_announce_request(iface, neigh, NULL); + ffd_send_announce_request(iface, neigh, FFD_NODE_ID_UNSPEC, 0, 0); } |