diff --git a/constants.h b/constants.h index 5c94c47e..77d1ec8c 100644 --- a/constants.h +++ b/constants.h @@ -121,38 +121,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define OVERLAY_INTERFACE_WIFI 2 #define OVERLAY_INTERFACE_PACKETRADIO 3 -/* - For each peer we need to keep track of the routes that we know to reach it. - - We want to use static sized data structures as much as we can to keep things efficient by - allowing computed memory address lookups instead of following linked lists and other - non-deterministic means. - - The tricky part of doing all this is that each interface may have a different maximum number - of peers based on the bandwidth of the link, as we do not want mesh traffic to consume all - available bandwidth. In particular, we need to reserve at least enough bandwidth for one - call. - - Related to this, if we are in a mesh larger than the per-interface limit allows, then we need to - only track the highest-scoring peers. This sounds simple, but how to we tell when to replace a - low-scoring peer with another one which has a better reachability score, if we are not tracking - the reachability score of that node? - - The answer to this is that we track as many nodes as we can, but only announce the highest - scoring nodes on each interface as bandwidth allows. - - This also keeps our memory usage fixed. - - XXX - At present we are setting OVERLAY_MAX_PEERS at compile time. - With a bit of work we can change this to be a run-time option. - - Memory consumption of OVERLAY_MAX_PEERS=n is O(n^2). - XXX We could and should improve this down the track by only monitoring the top k routes, and replacing the worst route - option when a better one comes along. This would get the memory usage down to O(n). - - */ -#define OVERLAY_MAX_PEERS 500 - #define OQ_ISOCHRONOUS_VOICE 0 #define OQ_MESH_MANAGEMENT 1 #define OQ_ISOCHRONOUS_VIDEO 2 diff --git a/serval.h b/serval.h index ca6bf897..30725700 100644 --- a/serval.h +++ b/serval.h @@ -394,31 +394,6 @@ extern overlay_interface overlay_interfaces[OVERLAY_MAX_INTERFACES]; extern int overlay_last_interface_number; // used to remember where a packet came from extern unsigned int overlay_sequence_number; - -typedef struct overlay_peer { - unsigned char address[SIDDIDFIELD_LEN]; - - /* Scores and score update times for reaching this node via various interfaces */ - int known_routes[OVERLAY_MAX_INTERFACES]; - unsigned short scores[OVERLAY_MAX_INTERFACES][OVERLAY_MAX_PEERS]; - - /* last_regeneration is the time that this peer was created/replaced with another peer. - lastupdate[] indicates the time that another peer's reachability report - caused us to update our score to reach via that peer. - If lastupdate[x][y] is older than last_regeneration[y], then we must - ignore the entry, because the lastupdate[x][y] entry references a previous - generation of that peer, i.e., not to the peer we think it does. - - This slight convolution allows us to replace peers without having to touch the - records of every other peer in our list. - */ - int last_regeneration; - unsigned int lastupdate[OVERLAY_MAX_INTERFACES][OVERLAY_MAX_PEERS]; -} overlay_peer; - -extern overlay_peer overlay_peers[OVERLAY_MAX_PEERS]; - - typedef struct overlay_txqueue { struct overlay_frame *first; struct overlay_frame *last;