-fixes in extension event handler

This commit is contained in:
Özgür Kesim 2022-06-27 18:06:44 +02:00
parent cddfaf007f
commit 206c7ec705
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7
2 changed files with 10 additions and 11 deletions

View File

@ -38,8 +38,8 @@ static struct GNUNET_DB_EventHandler *extensions_eh;
* the extensions data in the database.
*
* @param cls NULL
* @param extra unused
* @param extra_size number of bytes in @a extra unused
* @param extra type of the extension
* @param extra_size number of bytes in @a extra
*/
static void
extension_update_event_cb (void *cls,
@ -47,13 +47,14 @@ extension_update_event_cb (void *cls,
size_t extra_size)
{
(void) cls;
uint32_t nbo_type;
enum TALER_Extension_Type type;
const struct TALER_Extension *extension;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received extensions update event\n");
if (sizeof(enum TALER_Extension_Type) != extra_size)
if (sizeof(nbo_type) != extra_size)
{
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@ -61,8 +62,10 @@ extension_update_event_cb (void *cls,
return;
}
type = *(enum TALER_Extension_Type *) extra;
GNUNET_assert (NULL != extra);
nbo_type = *(uint32_t *) extra;
type = (enum TALER_Extension_Type) ntohl (nbo_type);
/* Get the corresponding extension */
extension = TALER_extensions_get_by_type (type);

View File

@ -121,20 +121,16 @@ set_extensions (void *cls,
/* Success, trigger event */
{
enum TALER_Extension_Type *type = &sec->extensions[i].type;
uint32_t nbo_type = htonl (sec->extensions[i].type);
struct GNUNET_DB_EventHeaderP ev = {
.size = htons (sizeof (ev)),
.type = htons (TALER_DBEVENT_EXCHANGE_EXTENSIONS_UPDATED)
};
// FIXME-Oec: bug: convert type to NBO first!
// FIXME-Oec: bug: sizeof enum is ill-defined...
// FIXME-Oec: bug: don't see /keys listening to the event
// FIXME-Oec: why is TEH_keys_update_states (); not enough?
TEH_plugin->event_notify (TEH_plugin->cls,
&ev,
type,
sizeof(*type));
&nbo_type,
sizeof(nbo_type));
}
}