Rediscover lost routes when forwarding packets. Also refresh route entries when sending packets through them. Patch from Jaroslav Meduna.

This commit is contained in:
Nicolas Tsiftes 2011-06-23 14:45:11 +02:00
parent 17da1fb933
commit 6749281a87

View file

@ -89,10 +89,15 @@ data_packet_forward(struct multihop_conn *multihop,
const rimeaddr_t *prevhop, uint8_t hops) const rimeaddr_t *prevhop, uint8_t hops)
{ {
struct route_entry *rt; struct route_entry *rt;
struct mesh_conn *c = (struct mesh_conn *)
((char *)multihop - offsetof(struct mesh_conn, multihop));
rt = route_lookup(dest); rt = route_lookup(dest);
if(rt == NULL) { if(rt == NULL) {
route_discovery_discover(&c->route_discovery_conn, dest, PACKET_TIMEOUT);
return NULL; return NULL;
} else {
route_refresh(rt);
} }
return &rt->nexthop; return &rt->nexthop;