aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/worker.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/worker.c b/src/worker.c
index 1144120..8cb09d1 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -22,6 +22,10 @@ jalv_worker_respond(LV2_Worker_Respond_Handle handle,
const void* data)
{
JalvWorker* worker = (JalvWorker*)handle;
+ if (zix_ring_write_space(worker->responses) < (sizeof(size) + size)) {
+ return LV2_WORKER_ERR_NO_SPACE;
+ }
+
zix_ring_write(worker->responses, (const char*)&size, sizeof(size));
zix_ring_write(worker->responses, (const char*)data, size);
return LV2_WORKER_SUCCESS;