aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorManuel Bachmann <manuel.bachmann@iot.bzh>2016-01-06 13:56:00 +0100
committerManuel Bachmann <manuel.bachmann@iot.bzh>2016-01-06 13:56:00 +0100
commita10fa6960df758dcfcb406dcee6383be5d494187 (patch)
tree676f64010ba300119031fae2c355cf142fec4218 /plugins
parent12686e3f00eb942bf587e99f80654400cc6995b6 (diff)
Fix Audio/Radio reinitialization issue
Audio and Radio plugins init() functions were re-creating a new client context each time, but it is actually unwanted as afb-radio <TokenRefresh> widgets uses this function to initialize AND refresh the context. Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/audio/audio-api.c3
-rw-r--r--plugins/radio/radio-api.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/plugins/audio/audio-api.c b/plugins/audio/audio-api.c
index 3877ce5b..8350377d 100644
--- a/plugins/audio/audio-api.c
+++ b/plugins/audio/audio-api.c
@@ -64,7 +64,8 @@ STATIC json_object* init (AFB_request *request) { /* AFB_SESSION_CHECK */
int idx;
/* create a private client context */
- request->context = initAudioCtx();
+ if (!request->context)
+ request->context = initAudioCtx();
_alsa_init("default", request->context);
diff --git a/plugins/radio/radio-api.c b/plugins/radio/radio-api.c
index b09cea86..d6855fea 100644
--- a/plugins/radio/radio-api.c
+++ b/plugins/radio/radio-api.c
@@ -131,7 +131,8 @@ STATIC json_object* init (AFB_request *request) { /* AFB_SESSION_CHECK */
json_object *jresp;
/* create a private client context */
- request->context = initRadioCtx();
+ if (!request->context)
+ request->context = initRadioCtx();
jresp = json_object_new_object();
json_object_object_add(jresp, "info", json_object_new_string ("Radio initialized"));