summaryrefslogtreecommitdiff
path: root/src/ot_livesync.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ot_livesync.c')
-rw-r--r--src/ot_livesync.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ot_livesync.c b/src/ot_livesync.c
index 083fe1a..18dae0d 100644
--- a/src/ot_livesync.c
+++ b/src/ot_livesync.c
@@ -4,6 +4,7 @@
4/* System */ 4/* System */
5#include <arpa/inet.h> 5#include <arpa/inet.h>
6#include <pthread.h> 6#include <pthread.h>
7#include <stdio.h>
7#include <stdlib.h> 8#include <stdlib.h>
8#include <string.h> 9#include <string.h>
9#include <sys/socket.h> 10#include <sys/socket.h>
@@ -200,9 +201,12 @@ static void *livesync_worker(void *args) {
200 201
201 (void)args; 202 (void)args;
202 203
203 /* Initialize our "thread local storage" */ 204 if (workstruct_init(&ws, LIVESYNC_INCOMING_BUFFSIZE) == -1) {
204 ws.inbuf = ws.request = malloc(LIVESYNC_INCOMING_BUFFSIZE); 205 fprintf(stderr, "Warning: live sync could not get its buffers and will not run.\n");
205 ws.outbuf = ws.reply = 0; 206 atomic_store(&thread_left, 1);
207 return NULL;
208 }
209 ws.request = ws.inbuf;
206 210
207 while (g_opentracker_running) { 211 while (g_opentracker_running) {
208 uint32_t packet_type; 212 uint32_t packet_type;
@@ -233,7 +237,7 @@ static void *livesync_worker(void *args) {
233 } 237 }
234 } 238 }
235 239
236 free(ws.inbuf); 240 workstruct_deinit(&ws);
237 atomic_store(&thread_left, 1); 241 atomic_store(&thread_left, 1);
238 return NULL; 242 return NULL;
239} 243}