Skip to content
Snippets Groups Projects
Commit fb4247bf authored by Nevadita's avatar Nevadita
Browse files

map-topology:Fixed status timer start and refresh interval

parent 63cea91e
No related branches found
No related tags found
1 merge request!5map-topology:Adding status changes and making changelog array dynamic
...@@ -47,7 +47,7 @@ map-topology provides the `topology` UBUS object with following methods : ...@@ -47,7 +47,7 @@ map-topology provides the `topology` UBUS object with following methods :
'topology' @fc2af0e9 'topology' @fc2af0e9
"refresh":{} "refresh":{}
"status":{} "status":{}
"refresh":{} "dump":{}
"changelog":{} "changelog":{}
```` ````
......
...@@ -175,10 +175,12 @@ void topologyd_algo_run(struct topologyd_private *priv) ...@@ -175,10 +175,12 @@ void topologyd_algo_run(struct topologyd_private *priv)
topologyd_send_ieee1905_topology_query(priv, NULL); topologyd_send_ieee1905_topology_query(priv, NULL);
dbg("Processing " MACFMT " AL\n", MAC2STR(p->hwaddr)); 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++) { for (j = 0; j < p->nbr_num; j++) {
dbg("sending req to " MACFMT "\n", MAC2STR(p->nbrlist[j])); dbg("sending req to " MACFMT "\n", MAC2STR(p->nbrlist[j]));
topologyd_send_ieee1905_topology_query(priv, 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) ...@@ -199,6 +201,9 @@ void topologyd_algo_run(struct topologyd_private *priv)
} }
priv->algo_running = false; priv->algo_running = false;
if (priv->status == 0)
uloop_timeout_set(&priv->status_timer, TOPOLOGY_STATUS_INTERVAL*1000);
dbg("\n====== Done Building Topology======\n"); dbg("\n====== Done Building Topology======\n");
} }
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "json_utils.h" #include "json_utils.h"
static int signal_pending; static int signal_pending;
extern int refresh_int;
extern const char *ubus_socket; extern const char *ubus_socket;
uint32_t topology_log_max; uint32_t topology_log_max;
...@@ -406,8 +405,8 @@ static void topologyd_periodic_refresh(struct uloop_timeout *t) ...@@ -406,8 +405,8 @@ static void topologyd_periodic_refresh(struct uloop_timeout *t)
topologyd_algo_run(priv); topologyd_algo_run(priv);
if (priv->refresh_int) if (priv->config.refresh_int)
uloop_timeout_set(&priv->refresh_timer, priv->refresh_int * 1000); uloop_timeout_set(&priv->refresh_timer, priv->config.refresh_int * 1000);
} }
static void topologyd_change_status(struct uloop_timeout *t) static void topologyd_change_status(struct uloop_timeout *t)
...@@ -454,12 +453,9 @@ static int topologyd_run(struct topologyd_private *priv) ...@@ -454,12 +453,9 @@ static int topologyd_run(struct topologyd_private *priv)
return -1; return -1;
} }
if(priv->refresh_int == 0)
priv->refresh_int = TOPOLOGY_REFRESH_INT;
topologyd_start_heartbeat(&priv->heartbeat); topologyd_start_heartbeat(&priv->heartbeat);
topologyd_periodic_refresh(&priv->refresh_timer); topologyd_periodic_refresh(&priv->refresh_timer);
uloop_timeout_set(&priv->status_timer, 90*1000);
//initalize the changelog values //initalize the changelog values
priv->topo.changelog_front = priv->topo.changelog_rear = -1; priv->topo.changelog_front = priv->topo.changelog_rear = -1;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define TOPOLOGY_NODE_MAX 32 #define TOPOLOGY_NODE_MAX 32
#define TOPOLOGY_NEIGHBOR_MAX 32 #define TOPOLOGY_NEIGHBOR_MAX 32
#define TOPOLOGY_VALIDITY 120 // 120 sec #define TOPOLOGY_VALIDITY 120 // 120 sec
#define TOPOLOGY_STATUS_INTERVAL 5
typedef uint32_t ieee1905_object_t; typedef uint32_t ieee1905_object_t;
...@@ -77,7 +78,6 @@ struct topologyd_config { ...@@ -77,7 +78,6 @@ struct topologyd_config {
struct topologyd_private { struct topologyd_private {
int debug; int debug;
uint32_t refresh_int;
bool algo_running; bool algo_running;
enum { INCOMPLETE, AVAILABLE } status; enum { INCOMPLETE, AVAILABLE } status;
struct ubus_context *ctx; struct ubus_context *ctx;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment