From 71e9837def30091db678cd3e93780b90924e2582 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 9 Sep 2021 16:20:21 +0200 Subject: ASAP::O: Don't send data to process_image if nothing came --- src/im-sandbox.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/im-sandbox.c') diff --git a/src/im-sandbox.c b/src/im-sandbox.c index 3da205f1..512a12df 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -454,6 +454,7 @@ static int run_work(const struct index_args *iargs, Stream *st, pargs.event = safe_strdup(event_str); free(line); + ok = 0; if ( sb->zmq ) { @@ -461,6 +462,7 @@ static int run_work(const struct index_args *iargs, Stream *st, pargs.zmq_data = im_zmq_fetch(zmqstuff, &pargs.zmq_data_size); } while ( pargs.zmq_data_size < 15 ); + ok = 1; /* The filename/event, which will be 'fake' values in * this case, still came via the event queue. More @@ -473,17 +475,23 @@ static int run_work(const struct index_args *iargs, Stream *st, * data comes via ASAP::O */ pargs.zmq_data = im_asapo_fetch(asapostuff, &pargs.zmq_data_size); + if ( pargs.zmq_data != NULL ) { + ok = 1; + } } else { pargs.zmq_data = NULL; pargs.zmq_data_size = 0; + ok = 1; } - sb->shared->time_last_start[cookie] = get_monotonic_seconds(); - profile_start("process-image"); - process_image(iargs, &pargs, st, cookie, tmpdir, ser, - sb->shared, sb->shared->last_task[cookie]); - profile_end("process-image"); + if ( ok ) { + sb->shared->time_last_start[cookie] = get_monotonic_seconds(); + profile_start("process-image"); + process_image(iargs, &pargs, st, cookie, tmpdir, ser, + sb->shared, sb->shared->last_task[cookie]); + profile_end("process-image"); + } /* pargs.zmq_data will be copied into the image structure, so * that it can be queried for "header" values etc. It will -- cgit v1.2.3