summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/rkt/rkt.c9
-rw-r--r--src/modules/rkt/rkt.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/modules/rkt/rkt.c b/src/modules/rkt/rkt.c
index 9aa18ee..4caa9ba 100644
--- a/src/modules/rkt/rkt.c
+++ b/src/modules/rkt/rkt.c
@@ -222,8 +222,13 @@ static void rkt_update_rocket(rkt_context_t *ctxt, unsigned ticks)
if (!s->connect)
return;
- if (!ctxt->connected || sync_update(ctxt->sync_device, ctxt->rocket_row, &rkt_sync_cb, ctxt) < 0)
- ctxt->connected = !sync_tcp_connect(ctxt->sync_device, s->host, s->port);
+ if (!ctxt->connected || sync_update(ctxt->sync_device, ctxt->rocket_row, &rkt_sync_cb, ctxt) < 0) {
+ /* limit connect attempts to 2HZ */
+ if (ticks - ctxt->last_connect >= 500) {
+ ctxt->connected = !sync_tcp_connect(ctxt->sync_device, s->host, s->port);
+ ctxt->last_connect = ticks;
+ }
+ }
}
diff --git a/src/modules/rkt/rkt.h b/src/modules/rkt/rkt.h
index 4ec8599..53b9eba 100644
--- a/src/modules/rkt/rkt.h
+++ b/src/modules/rkt/rkt.h
@@ -22,6 +22,7 @@ typedef struct rkt_context_t {
double rows_per_ms;
double rocket_row;
unsigned last_ticks;
+ unsigned last_connect; /* ticks at last connect attempt */
unsigned paused:1;
unsigned connected:1; /* currently connected to the RocketEditor */
size_t n_scenes;
© All Rights Reserved