From 5e4dfeb7fb48a506f25af0c206ee65a5f7de7f58 Mon Sep 17 00:00:00 2001 From: Gabor X Toth <*@tg-x.net> Date: Sat, 5 Sep 2015 23:44:03 +0000 Subject: psyc: add STATE_MODIFY flag during transmit --- src/psycstore/psyc_util_lib.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'src/psycstore') diff --git a/src/psycstore/psyc_util_lib.c b/src/psycstore/psyc_util_lib.c index 54ae626c5..7b13ac57f 100644 --- a/src/psycstore/psyc_util_lib.c +++ b/src/psycstore/psyc_util_lib.c @@ -677,16 +677,6 @@ GNUNET_PSYC_transmit_message (struct GNUNET_PSYC_TransmitHandle *tmit, tmit->msg = GNUNET_malloc (sizeof (*tmit->msg) + sizeof (*pmeth) + size); tmit->msg->size = sizeof (*tmit->msg) + sizeof (*pmeth) + size; - pmeth = (struct GNUNET_PSYC_MessageMethod *) &tmit->msg[1]; - pmeth->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD); - pmeth->header.size = htons (sizeof (*pmeth) + size); - pmeth->flags = htonl (flags); - memcpy (&pmeth[1], method_name, size); - - tmit->state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER; - tmit->notify_data = notify_data; - tmit->notify_data_cls = notify_cls; - if (NULL != notify_mod) { tmit->notify_mod = notify_mod; @@ -701,6 +691,13 @@ GNUNET_PSYC_transmit_message (struct GNUNET_PSYC_TransmitHandle *tmit, struct GNUNET_ENV_Modifier mod = {}; mod.next = GNUNET_ENV_environment_head (env); tmit->mod = &mod; + + struct GNUNET_ENV_Modifier *m = tmit->mod; + while (NULL != (m = m->next)) + { + if (m->oper != GNUNET_ENV_OP_SET) + flags |= GNUNET_PSYC_MASTER_TRANSMIT_STATE_MODIFY; + } } else { @@ -708,6 +705,16 @@ GNUNET_PSYC_transmit_message (struct GNUNET_PSYC_TransmitHandle *tmit, } } + pmeth = (struct GNUNET_PSYC_MessageMethod *) &tmit->msg[1]; + pmeth->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_METHOD); + pmeth->header.size = htons (sizeof (*pmeth) + size); + pmeth->flags = htonl (flags); + memcpy (&pmeth[1], method_name, size); + + tmit->state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER; + tmit->notify_data = notify_data; + tmit->notify_data_cls = notify_cls; + transmit_mod (tmit); return GNUNET_OK; } -- cgit v1.2.3