aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-04-12 17:12:10 +0200
committerThomas White <taw@physics.org>2023-06-01 15:31:50 +0200
commite922cc649959d2f05dc4df44b0d5889b0fcdb32c (patch)
treeeab9eb140cb02e9264be7486b6d66ae939527584 /src
parent6d11d4f13eb46d67f5a619dec93f4b6c4c0d9718 (diff)
ASAP::O: Use message ID as serial number
Diffstat (limited to 'src')
-rw-r--r--src/im-asapo.c9
-rw-r--r--src/im-asapo.h5
-rw-r--r--src/im-sandbox.c8
3 files changed, 15 insertions, 7 deletions
diff --git a/src/im-asapo.c b/src/im-asapo.c
index 82934d50..43455298 100644
--- a/src/im-asapo.c
+++ b/src/im-asapo.c
@@ -3,11 +3,11 @@
*
* ASAP::O data interface
*
- * Copyright © 2021 Deutsches Elektronen-Synchrotron DESY,
- * a research centre of the Helmholtz Association.
+ * Copyright © 2021-2023 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
*
* Authors:
- * 2021 Thomas White <taw@physics.org>
+ * 2021-2023 Thomas White <taw@physics.org>
*
* This file is part of CrystFEL.
*
@@ -144,7 +144,7 @@ static int stream_empty(struct im_asapo *a)
void *im_asapo_fetch(struct im_asapo *a, size_t *pdata_size,
char **pmeta, char **pfilename, char **pevent,
- int *pfinished)
+ int *pfinished, int *pmessageid)
{
void *data_copy;
AsapoMessageMetaHandle meta;
@@ -204,6 +204,7 @@ void *im_asapo_fetch(struct im_asapo *a, size_t *pdata_size,
*pmeta = strdup(asapo_message_meta_get_metadata(meta));
*pfilename = strdup(asapo_message_meta_get_name(meta));
*pevent = strdup("//");
+ *pmessageid = asapo_message_meta_get_id(meta);
profile_end("copy-meta");
asapo_free_handle(&err);
diff --git a/src/im-asapo.h b/src/im-asapo.h
index cda9fbd9..cf7edfe4 100644
--- a/src/im-asapo.h
+++ b/src/im-asapo.h
@@ -53,7 +53,7 @@ extern void im_asapo_shutdown(struct im_asapo *a);
extern void *im_asapo_fetch(struct im_asapo *a, size_t *pdata_size,
char **pmeta, char **pfilename, char **pevent,
- int *pfinished);
+ int *pfinished, int *pmessageid);
#else /* defined(HAVE_ASAPO) */
@@ -69,13 +69,14 @@ static UNUSED void im_asapo_shutdown(struct im_asapo *a)
static UNUSED void *im_asapo_fetch(struct im_asapo *a, size_t *psize,
char **pmeta, char **pfilename, char **pevent,
- int *pfinished)
+ int *pfinished, int *pmessageid)
{
*psize = 0;
*pmeta = NULL;
*pfilename = NULL;
*pevent = NULL;
*pfinished = 1;
+ *pmessageid = 0;
return NULL;
}
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 51d9db99..63ebc537 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -476,6 +476,7 @@ static int run_work(const struct index_args *iargs, Stream *st,
char *filename;
char *event;
int finished = 0;
+ int message_id;
profile_start("asapo-fetch");
set_last_task(sb->shared->last_task[cookie], "ASAPO fetch");
@@ -484,7 +485,8 @@ static int run_work(const struct index_args *iargs, Stream *st,
&pargs.asapo_meta,
&filename,
&event,
- &finished);
+ &finished,
+ &message_id);
profile_end("asapo-fetch");
if ( pargs.asapo_data != NULL ) {
ok = 1;
@@ -496,6 +498,10 @@ static int run_work(const struct index_args *iargs, Stream *st,
pargs.filename = filename;
pargs.event = event;
sb->shared->end_of_stream[cookie] = 0;
+
+ /* We will also use ASAP::O's serial number
+ * instead of our own. */
+ ser = message_id;
} else {
if ( finished ) {
sb->shared->end_of_stream[cookie] = 1;