aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2020-02-25 23:14:55 +0100
committercbdev <cb@cbcdn.com>2020-02-25 23:14:55 +0100
commit0a59a6bd47597d4577c0a550779d2e352127d186 (patch)
tree811aa3c671b369e486b5961943311bb11d8850c4
parentdd91621ccee033550312683293b5bf40c3599053 (diff)
downloadmidimonster-0a59a6bd47597d4577c0a550779d2e352127d186.tar.gz
midimonster-0a59a6bd47597d4577c0a550779d2e352127d186.tar.bz2
midimonster-0a59a6bd47597d4577c0a550779d2e352127d186.zip
Implement quiet mode for maweb backend
-rw-r--r--backends/maweb.c17
-rw-r--r--backends/maweb.md1
2 files changed, 16 insertions, 2 deletions
diff --git a/backends/maweb.c b/backends/maweb.c
index 6a006bd..6861d75 100644
--- a/backends/maweb.c
+++ b/backends/maweb.c
@@ -15,10 +15,15 @@
#define WS_FLAG_FIN 0x80
#define WS_FLAG_MASK 0x80
+/*
+ * TODO handle peer close/unregister/reopen and fallback connections
+ */
+
static uint64_t last_keepalive = 0;
static uint64_t update_interval = 50;
static uint64_t last_update = 0;
static uint64_t updates_inflight = 0;
+static uint64_t quiet_mode = 0;
static maweb_command_key cmdline_keys[] = {
{"PREV", 109, 0, 1}, {"SET", 108, 1, 0, 1}, {"NEXT", 110, 0, 1},
@@ -139,6 +144,10 @@ static int maweb_configure(char* option, char* value){
update_interval = strtoul(value, NULL, 10);
return 0;
}
+ else if(!strcmp(option, "quiet")){
+ quiet_mode = strtoul(value, NULL, 10);
+ return 0;
+ }
LOGPF("Unknown backend configuration option %s", option);
return 1;
@@ -457,7 +466,9 @@ static int maweb_request_playbacks(instance* inst){
size_t page_index = 0, view = 3, channel = 0, offsets[3], channel_offset, channels;
if(updates_inflight){
- LOGPF("Skipping update request, %" PRIu64 " updates still inflight", updates_inflight);
+ if(quiet_mode < 1){
+ LOGPF("Skipping update request, %" PRIu64 " updates still inflight - consider raising the interval time", updates_inflight);
+ }
return 0;
}
@@ -588,7 +599,9 @@ static int maweb_handle_message(instance* inst, char* payload, size_t payload_le
data->login = 0;
return 0;
}
- LOGPF("Session id is now %" PRId64, data->session);
+ if(quiet_mode < 2){
+ LOGPF("Session id is now %" PRId64, data->session);
+ }
}
if(json_obj_bool(payload, "forceLogin", 0)){
diff --git a/backends/maweb.md b/backends/maweb.md
index 8ce65ef..eddf1a5 100644
--- a/backends/maweb.md
+++ b/backends/maweb.md
@@ -19,6 +19,7 @@ Web Remote. Set a web remote password using the option below the activation sett
| Option | Example value | Default value | Description |
|---------------|-----------------------|-----------------------|---------------------------------------------------------------|
| `interval` | `100` | `50` | Query interval for input data polling (in msec) |
+| `quiet` | `1` | `0` | Turn off some warning messages, for use by experts |
#### Instance configuration