int n_assoc = 0;
int rem;
+ usteer_update_time();
+
list_for_each_entry(si, &node->sta_info, node_list) {
if (si->connected)
si->connected = STA_DISCONNECTED;
h->update_sta(node, si);
}
usteer_local_node_assoc_update(si, cur);
- if (si->connected == STA_CONNECTED)
+ if (si->connected == STA_CONNECTED) {
+ si->last_connected = current_time;
n_assoc++;
+ }
}
node->n_assoc = n_assoc;
[APMSG_STA_SEEN] = { .type = BLOB_ATTR_INT32 },
[APMSG_STA_TIMEOUT] = { .type = BLOB_ATTR_INT32 },
[APMSG_STA_CONNECTED] = { .type = BLOB_ATTR_INT8 },
+ [APMSG_STA_LAST_CONNECTED] = { .type = BLOB_ATTR_INT32 },
};
struct blob_attr *tb[__APMSG_STA_MAX];
!tb[APMSG_STA_SIGNAL] ||
!tb[APMSG_STA_SEEN] ||
!tb[APMSG_STA_TIMEOUT] ||
- !tb[APMSG_STA_CONNECTED])
+ !tb[APMSG_STA_CONNECTED] ||
+ !tb[APMSG_STA_LAST_CONNECTED])
return false;
if (blob_len(tb[APMSG_STA_ADDR]) != sizeof(msg->addr))
msg->seen = blob_get_int32(tb[APMSG_STA_SEEN]);
msg->timeout = blob_get_int32(tb[APMSG_STA_TIMEOUT]);
msg->connected = blob_get_int8(tb[APMSG_STA_CONNECTED]);
+ msg->last_connected = blob_get_int32(tb[APMSG_STA_LAST_CONNECTED]);
return true;
}
si->connected = msg.connected;
si->signal = msg.signal;
si->seen = current_time - msg.seen;
+ si->last_connected = current_time - msg.last_connected;
usteer_sta_info_update_timeout(si, msg.timeout);
}
static void usteer_send_sta_info(struct sta_info *sta)
{
int seen = current_time - sta->seen;
+ int last_connected = !!sta->connected ? 0 : current_time - sta->last_connected;
void *c;
c = blob_nest_start(&buf, 0);
blob_put_int8(&buf, APMSG_STA_CONNECTED, !!sta->connected);
blob_put_int32(&buf, APMSG_STA_SIGNAL, sta->signal);
blob_put_int32(&buf, APMSG_STA_SEEN, seen);
+ blob_put_int32(&buf, APMSG_STA_LAST_CONNECTED, last_connected);
blob_put_int32(&buf, APMSG_STA_TIMEOUT, config.local_sta_timeout - seen);
blob_nest_end(&buf, c);
}
APMSG_STA_TIMEOUT,
APMSG_STA_SEEN,
APMSG_STA_CONNECTED,
+ APMSG_STA_LAST_CONNECTED,
__APMSG_STA_MAX
};
int signal;
int timeout;
int seen;
+ int last_connected;
};
bool parse_apmsg(struct apmsg *msg, struct blob_attr *data);
struct sta_info_stats stats[__EVENT_TYPE_MAX];
uint64_t created;
uint64_t seen;
+ uint64_t last_connected;
int signal;
enum roam_trigger_state roam_state;