Bug #303

LQINetworkBrowserThread misses devices

Added by Philipp Buluschek over 3 years ago.

Status:New Start date:02/24/2015
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:- Spent time: -
Target version:-
Has a patch:No Has license agreement signed:No

Description

In LQINetworkBrowserThread, to get the full list of neighbors from a device, several requests may be necessary. This is done through recursion with the following code:

private List<NetworkAddressNodeItem> lqiRequestToNode(NetworkAddressNodeItem node, int index){
  ...
  if ( lqi_resp.getNeighborLQIEntries() > ( lqi_resp.getNeighborLQICount() + index + 1 ) ) {
    lqiRequestToNode( node, lqi_resp.getNeighborLQICount() + index + 1 );
  }
}

But these boundaries are wrong. Suppose you have 4 entries in total (with indexes 0,1,2,3), and you get 3 in return in the first request. This means you should make an additional request to get the last one, with a start index of 3.

The above code doesn't do this. The correct code is instead:

//                    4               >                 3                +   0  // OK, do an additional request
if ( lqi_resp.getNeighborLQIEntries() > ( lqi_resp.getNeighborLQICount() + index) ) {
  //                                     3               +   0  // do it with start index 3
  lqiRequestToNode( node, lqi_resp.getNeighborLQICount() + index);
}

Also available in: Atom PDF