-fixes in extension event handler
This commit is contained in:
parent
cddfaf007f
commit
206c7ec705
@ -38,8 +38,8 @@ static struct GNUNET_DB_EventHandler *extensions_eh;
|
|||||||
* the extensions data in the database.
|
* the extensions data in the database.
|
||||||
*
|
*
|
||||||
* @param cls NULL
|
* @param cls NULL
|
||||||
* @param extra unused
|
* @param extra type of the extension
|
||||||
* @param extra_size number of bytes in @a extra unused
|
* @param extra_size number of bytes in @a extra
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
extension_update_event_cb (void *cls,
|
extension_update_event_cb (void *cls,
|
||||||
@ -47,13 +47,14 @@ extension_update_event_cb (void *cls,
|
|||||||
size_t extra_size)
|
size_t extra_size)
|
||||||
{
|
{
|
||||||
(void) cls;
|
(void) cls;
|
||||||
|
uint32_t nbo_type;
|
||||||
enum TALER_Extension_Type type;
|
enum TALER_Extension_Type type;
|
||||||
const struct TALER_Extension *extension;
|
const struct TALER_Extension *extension;
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Received extensions update event\n");
|
"Received extensions update event\n");
|
||||||
|
|
||||||
if (sizeof(enum TALER_Extension_Type) != extra_size)
|
if (sizeof(nbo_type) != extra_size)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
|
||||||
@ -61,8 +62,10 @@ extension_update_event_cb (void *cls,
|
|||||||
return;
|
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 */
|
/* Get the corresponding extension */
|
||||||
extension = TALER_extensions_get_by_type (type);
|
extension = TALER_extensions_get_by_type (type);
|
||||||
|
@ -121,20 +121,16 @@ set_extensions (void *cls,
|
|||||||
|
|
||||||
/* Success, trigger event */
|
/* 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 = {
|
struct GNUNET_DB_EventHeaderP ev = {
|
||||||
.size = htons (sizeof (ev)),
|
.size = htons (sizeof (ev)),
|
||||||
.type = htons (TALER_DBEVENT_EXCHANGE_EXTENSIONS_UPDATED)
|
.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,
|
TEH_plugin->event_notify (TEH_plugin->cls,
|
||||||
&ev,
|
&ev,
|
||||||
type,
|
&nbo_type,
|
||||||
sizeof(*type));
|
sizeof(nbo_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user