Remove returning token
[src/app-framework-binder.git] / src / afb-monitor.c
index a50e2c6..e32c85a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016, 2017, 2018 "IoT.bzh"
+ * Copyright (C) 2016-2019 "IoT.bzh"
  * Author José Bollo <jose.bollo@iot.bzh>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -218,7 +218,7 @@ static struct json_object *get_verbosity(struct json_object *spec)
                        json_object_iter_next(&it);
                }
        } else if (json_object_is_type(spec, json_type_array)) {
-               n = json_object_array_length(spec);
+               n = (int)json_object_array_length(spec);
                for (i = 0 ; i < n ; i++)
                        get_verbosity_of(resu, json_object_get_string(json_object_array_get_idx(spec, i)));
        } else if (json_object_is_type(spec, json_type_string)) {
@@ -280,7 +280,7 @@ static struct json_object *get_apis(struct json_object *spec)
                        json_object_iter_next(&it);
                }
        } else if (json_object_is_type(spec, json_type_array)) {
-               n = json_object_array_length(spec);
+               n = (int)json_object_array_length(spec);
                for (i = 0 ; i < n ; i++)
                        get_one_api(resu, json_object_get_string(json_object_array_get_idx(spec, i)), NULL);
        } else if (json_object_is_type(spec, json_type_string)) {
@@ -297,7 +297,6 @@ static struct json_object *get_apis(struct json_object *spec)
 
 static const char _verbosity_[] = "verbosity";
 static const char _apis_[] = "apis";
-static const char _refresh_token_[] = "refresh-token";
 
 static void f_get(afb_req_t req)
 {
@@ -326,6 +325,7 @@ static void f_set(afb_req_t req)
        afb_req_success(req, NULL, NULL);
 }
 
+#if WITH_AFB_TRACE
 static void *context_create(void *closure)
 {
        return afb_trace_create(_afb_binding_monitor.api, NULL);
@@ -360,12 +360,18 @@ static void f_trace(afb_req_t req)
 end:
        afb_apiset_update_hooks(target_set, NULL);
        afb_evt_update_hooks();
+       return;
 }
+#else
+static void f_trace(afb_req_t req)
+{
+       afb_req_reply(req, NULL, "not-available", NULL);
+}
+#endif
 
 static void f_session(afb_req_t req)
 {
        struct json_object *r = NULL;
-       int refresh = 0;
        struct afb_xreq *xreq = xreq_from_req_x2(req);
 
        /* check right to call it */
@@ -374,15 +380,9 @@ static void f_session(afb_req_t req)
                return;
        }
 
-       /* renew the token if required */
-       wrap_json_unpack(afb_req_json(req), "{s?:b}", _refresh_token_, &refresh);
-       if (refresh)
-               afb_context_refresh(&xreq->context);
-
        /* make the result */
-       wrap_json_pack(&r, "{s:s,s:s,s:i,s:i}",
+       wrap_json_pack(&r, "{s:s,s:i,s:i}",
                        "uuid", afb_session_uuid(xreq->context.session),
-                       "token", afb_session_token(xreq->context.session),
                        "timeout", afb_session_timeout(xreq->context.session),
                        "remain", afb_session_what_remains(xreq->context.session));
        afb_req_success(req, r, NULL);