summaryrefslogtreecommitdiffstats
path: root/src/status.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-09-15 16:35:34 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-09-15 16:35:34 +0200
commit316180d885042b7ea2f2f1f67c3175c0a1ad41fa (patch)
tree77f2fb0d5778455c2bed55be348cf06c3380a651 /src/status.c
parent7ebbe05f46e1b8530a61dd144a4bf36a1c63a4a3 (diff)
downloadfastd-316180d885042b7ea2f2f1f67c3175c0a1ad41fa.tar
fastd-316180d885042b7ea2f2f1f67c3175c0a1ad41fa.zip
status: add uptime and established times
Diffstat (limited to 'src/status.c')
-rw-r--r--src/status.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/status.c b/src/status.c
index 0e688a5..fd34747 100644
--- a/src/status.c
+++ b/src/status.c
@@ -115,6 +115,8 @@ static json_object * dump_peer(const fastd_peer_t *peer) {
if (fastd_peer_is_established(peer)) {
connection = json_object_new_object();
+ json_object_object_add(connection, "established", json_object_new_int64(ctx.now - peer->established));
+
struct json_object *method = NULL;
const fastd_method_info_t *method_info = conf.protocol->get_current_method(peer);
@@ -158,6 +160,8 @@ static json_object * dump_peer(const fastd_peer_t *peer) {
static void dump_status(int fd) {
struct json_object *json = json_object_new_object();
+ json_object_object_add(json, "uptime", json_object_new_int64(ctx.now - ctx.started));
+
json_object_object_add(json, "statistics", dump_stats(&ctx.stats));
struct json_object *peers = json_object_new_object();