diff --git a/README.md b/README.md index c4160a5a77a8de8c5e6388d26549c1c74179e3b8..319065f6952d8773a4db32a796a742ca2facfad4 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ map-topology provides the `topology` UBUS object with following methods : 'topology' @fc2af0e9 "refresh":{} "status":{} - "refresh":{} + "dump":{} "changelog":{} ```` diff --git a/src/topo_ieee1905.c b/src/topo_ieee1905.c index 94811d74442df3bd3ea7a2a3378a9b0fd29b4fc3..011d5aeb576659a8befe2ece73e2292427ab8915 100644 --- a/src/topo_ieee1905.c +++ b/src/topo_ieee1905.c @@ -175,10 +175,12 @@ void topologyd_algo_run(struct topologyd_private *priv) topologyd_send_ieee1905_topology_query(priv, NULL); dbg("Processing " MACFMT " AL\n", MAC2STR(p->hwaddr)); + dbg("The total nodes are %d", p->nbr_num); for (j = 0; j < p->nbr_num; j++) { dbg("sending req to " MACFMT "\n", MAC2STR(p->nbrlist[j])); topologyd_send_ieee1905_topology_query(priv, p->nbrlist[j]); + dbg("Processing " MACFMT " AL\n", MAC2STR(p->nbrlist[j])); } } @@ -199,6 +201,9 @@ void topologyd_algo_run(struct topologyd_private *priv) } priv->algo_running = false; + + if (priv->status == 0) + uloop_timeout_set(&priv->status_timer, TOPOLOGY_STATUS_INTERVAL*1000); dbg("\n====== Done Building Topology======\n"); } diff --git a/src/topologyd.c b/src/topologyd.c index 0a6e2f0dc936e84c62015fdeea4ede7d845326e5..3c21c591aa2389fc0d93d606ef9ee55e3ccdffe8 100644 --- a/src/topologyd.c +++ b/src/topologyd.c @@ -23,7 +23,6 @@ #include "json_utils.h" static int signal_pending; -extern int refresh_int; extern const char *ubus_socket; uint32_t topology_log_max; @@ -406,8 +405,8 @@ static void topologyd_periodic_refresh(struct uloop_timeout *t) topologyd_algo_run(priv); - if (priv->refresh_int) - uloop_timeout_set(&priv->refresh_timer, priv->refresh_int * 1000); + if (priv->config.refresh_int) + uloop_timeout_set(&priv->refresh_timer, priv->config.refresh_int * 1000); } static void topologyd_change_status(struct uloop_timeout *t) @@ -454,12 +453,9 @@ static int topologyd_run(struct topologyd_private *priv) return -1; } - if(priv->refresh_int == 0) - priv->refresh_int = TOPOLOGY_REFRESH_INT; topologyd_start_heartbeat(&priv->heartbeat); topologyd_periodic_refresh(&priv->refresh_timer); - uloop_timeout_set(&priv->status_timer, 90*1000); //initalize the changelog values priv->topo.changelog_front = priv->topo.changelog_rear = -1; diff --git a/src/topologyd.h b/src/topologyd.h index 293918acbc73d2b8743bef73c3b11e264abb9193..41b901479bbdcc2ae01fd466e5fe01a5633534f7 100644 --- a/src/topologyd.h +++ b/src/topologyd.h @@ -22,6 +22,7 @@ #define TOPOLOGY_NODE_MAX 32 #define TOPOLOGY_NEIGHBOR_MAX 32 #define TOPOLOGY_VALIDITY 120 // 120 sec +#define TOPOLOGY_STATUS_INTERVAL 5 typedef uint32_t ieee1905_object_t; @@ -77,7 +78,6 @@ struct topologyd_config { struct topologyd_private { int debug; - uint32_t refresh_int; bool algo_running; enum { INCOMPLETE, AVAILABLE } status; struct ubus_context *ctx;