hooks: Allow to remove hooking (and/or trace)
[src/app-framework-binder.git] / src / afb-monitor.c
index 68da884..15dd1a4 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");
@@ -326,6 +326,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,7 +361,14 @@ 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)
 {