aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-12-01 16:55:24 +0100
committerThomas White <taw@physics.org>2022-06-02 12:15:38 +0200
commitaf270239fa00eb4ca295fb4d866064bfd8a767b7 (patch)
tree6e0feb366d49b6303abfba5e6cc3f108b0f9590f
parent6aff9f9d2fd6cd4e028871e8162536f9e7fa1683 (diff)
ASAP::O: Pass filename through
-rw-r--r--src/im-asapo.c9
-rw-r--r--src/im-asapo.h8
-rw-r--r--src/im-sandbox.c11
3 files changed, 21 insertions, 7 deletions
diff --git a/src/im-asapo.c b/src/im-asapo.c
index eac85375..ff5c010a 100644
--- a/src/im-asapo.c
+++ b/src/im-asapo.c
@@ -226,7 +226,8 @@ static void skip_to_stream_end(struct im_asapo *a)
}
-void *im_asapo_fetch(struct im_asapo *a, size_t *pdata_size)
+void *im_asapo_fetch(struct im_asapo *a, size_t *pdata_size,
+ char **pfilename, char **pevent)
{
void *data_copy;
AsapoMessageMetaHandle meta;
@@ -265,9 +266,6 @@ void *im_asapo_fetch(struct im_asapo *a, size_t *pdata_size)
msg_size = asapo_message_meta_get_size(meta);
- STATUS("ASAP::O ID: %llu\n", asapo_message_meta_get_id(meta));
- STATUS("ASAP::O filename: %s\n", asapo_message_meta_get_name(meta));
-
data_copy = malloc(msg_size);
if ( data_copy == NULL ) {
ERROR("Failed to copy data block.\n");
@@ -278,6 +276,9 @@ void *im_asapo_fetch(struct im_asapo *a, size_t *pdata_size)
}
memcpy(data_copy, asapo_message_data_get_as_chars(data), msg_size);
+ *pfilename = strdup(asapo_message_meta_get_id(meta));
+ *pevent = strdup("//");
+
asapo_free_handle(&err);
asapo_free_handle(&meta);
asapo_free_handle(&data);
diff --git a/src/im-asapo.h b/src/im-asapo.h
index 61d237db..26546a88 100644
--- a/src/im-asapo.h
+++ b/src/im-asapo.h
@@ -44,7 +44,8 @@ extern struct im_asapo *im_asapo_connect(const char *endpoint,
extern void im_asapo_shutdown(struct im_asapo *a);
-extern void *im_asapo_fetch(struct im_asapo *a, size_t *pdata_size);
+extern void *im_asapo_fetch(struct im_asapo *a, size_t *pdata_size,
+ char **pfilename, char **pevent);
extern char *im_asapo_make_unique_group_id(const char *endpoint,
const char *token);
@@ -64,9 +65,12 @@ static UNUSED void im_asapo_shutdown(struct im_asapo *a)
{
}
-static UNUSED void *im_asapo_fetch(struct im_asapo *a, size_t *psize)
+static UNUSED void *im_asapo_fetch(struct im_asapo *a, size_t *psize,
+ char **pfilename, char **pevent)
{
*psize = 0;
+ *pfilename = NULL;
+ *pevent = NULL;
return NULL;
}
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 0933ab31..059f4a74 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -471,12 +471,21 @@ static int run_work(const struct index_args *iargs, Stream *st,
} else if ( sb->asapo ) {
+ char *filename;
+ char *event;
+
/* Temporary (?) abuse of "zmq_data", even though
* data comes via ASAP::O */
pargs.zmq_data = im_asapo_fetch(asapostuff,
- &pargs.zmq_data_size);
+ &pargs.zmq_data_size,
+ &filename,
+ &event);
if ( pargs.zmq_data != NULL ) {
ok = 1;
+ free(pargs.filename);
+ free(pargs.event);
+ pargs.filename = filename;
+ pargs.event = event;
}
} else {