projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
allow MST callback to distinguish between disconnect and parse error situations,...
[oweals/gnunet.git]
/
src
/
core
/
gnunet-service-core_typemap.c
diff --git
a/src/core/gnunet-service-core_typemap.c
b/src/core/gnunet-service-core_typemap.c
index e12e3863aaaed63f88a0b5b2a53e6c29eed8ab09..0600f59ef937af81afb905438ae8d222961a5767 100644
(file)
--- a/
src/core/gnunet-service-core_typemap.c
+++ b/
src/core/gnunet-service-core_typemap.c
@@
-1,6
+1,6
@@
/*
This file is part of GNUnet.
/*
This file is part of GNUnet.
- Copyright (C) 2011-2014
Christian Grothoff (and other contributing authors)
+ Copyright (C) 2011-2014
GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@
-14,8
+14,8
@@
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 5
9 Temple Place - Suite 330
,
- Boston, MA 0211
1-1307
, USA.
+ Free Software Foundation, Inc., 5
1 Franklin Street, Fifth Floor
,
+ Boston, MA 0211
0-1301
, USA.
*/
/**
*/
/**
@@
-136,7
+136,7
@@
GSC_TYPEMAP_compute_type_map_message ()
{
/* compression failed, use uncompressed map */
dlen = sizeof (my_type_map);
{
/* compression failed, use uncompressed map */
dlen = sizeof (my_type_map);
- memcpy (tmp, &my_type_map, sizeof (my_type_map));
+
GNUNET_
memcpy (tmp, &my_type_map, sizeof (my_type_map));
hdr->type = htons (GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP);
}
else
hdr->type = htons (GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP);
}
else
@@
-174,11
+174,13
@@
GSC_TYPEMAP_get_from_message (const struct GNUNET_MessageHeader *msg)
return NULL;
}
ret = GNUNET_new (struct GSC_TypeMap);
return NULL;
}
ret = GNUNET_new (struct GSC_TypeMap);
- memcpy (ret, &msg[1], sizeof (struct GSC_TypeMap));
+
GNUNET_
memcpy (ret, &msg[1], sizeof (struct GSC_TypeMap));
return ret;
case GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP:
return ret;
case GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP:
- GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# type maps received"),
- 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (GSC_stats,
+ gettext_noop ("# type maps received"),
+ 1,
+ GNUNET_NO);
ret = GNUNET_new (struct GSC_TypeMap);
dlen = sizeof (struct GSC_TypeMap);
if ((Z_OK !=
ret = GNUNET_new (struct GSC_TypeMap);
dlen = sizeof (struct GSC_TypeMap);
if ((Z_OK !=
@@
-207,7
+209,8
@@
broadcast_my_type_map ()
hdr = GSC_TYPEMAP_compute_type_map_message ();
GNUNET_STATISTICS_update (GSC_stats,
hdr = GSC_TYPEMAP_compute_type_map_message ();
GNUNET_STATISTICS_update (GSC_stats,
- gettext_noop ("# updates to my type map"), 1,
+ gettext_noop ("# updates to my type map"),
+ 1,
GNUNET_NO);
GSC_SESSIONS_broadcast_typemap (hdr);
GNUNET_free (hdr);
GNUNET_NO);
GSC_SESSIONS_broadcast_typemap (hdr);
GNUNET_free (hdr);
@@
-238,6
+241,8
@@
GSC_TYPEMAP_add (const uint16_t *types,
}
if (GNUNET_YES == changed)
{
}
if (GNUNET_YES == changed)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Typemap changed, broadcasting!\n");
rehash_typemap ();
broadcast_my_type_map ();
}
rehash_typemap ();
broadcast_my_type_map ();
}
@@
-254,11
+259,10
@@
void
GSC_TYPEMAP_remove (const uint16_t *types,
unsigned int tlen)
{
GSC_TYPEMAP_remove (const uint16_t *types,
unsigned int tlen)
{
- unsigned int i;
int changed;
changed = GNUNET_NO;
int changed;
changed = GNUNET_NO;
- for (i = 0; i < tlen; i++)
+ for (
unsigned int
i = 0; i < tlen; i++)
{
if (0 == --map_counters[types[i]])
{
{
if (0 == --map_counters[types[i]])
{
@@
-288,13
+292,11
@@
GSC_TYPEMAP_test_match (const struct GSC_TypeMap *tmap,
const uint16_t *types,
unsigned int tcnt)
{
const uint16_t *types,
unsigned int tcnt)
{
- unsigned int i;
-
if (NULL == tmap)
return GNUNET_NO;
if (0 == tcnt)
return GNUNET_YES; /* matches all */
if (NULL == tmap)
return GNUNET_NO;
if (0 == tcnt)
return GNUNET_YES; /* matches all */
- for (i = 0; i < tcnt; i++)
+ for (
unsigned int
i = 0; i < tcnt; i++)
if (0 != (tmap->bits[types[i] / 32] & (1 << (types[i] % 32))))
return GNUNET_YES;
return GNUNET_NO;
if (0 != (tmap->bits[types[i] / 32] & (1 << (types[i] % 32))))
return GNUNET_YES;
return GNUNET_NO;
@@
-315,12
+317,11
@@
GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap,
unsigned int tcnt)
{
struct GSC_TypeMap *ret;
unsigned int tcnt)
{
struct GSC_TypeMap *ret;
- unsigned int i;
ret = GNUNET_new (struct GSC_TypeMap);
if (NULL != tmap)
ret = GNUNET_new (struct GSC_TypeMap);
if (NULL != tmap)
- memcpy (ret, tmap, sizeof (struct GSC_TypeMap));
- for (i = 0; i < tcnt; i++)
+
GNUNET_
memcpy (ret, tmap, sizeof (struct GSC_TypeMap));
+ for (
unsigned int
i = 0; i < tcnt; i++)
ret->bits[types[i] / 32] |= (1 << (types[i] % 32));
return ret;
}
ret->bits[types[i] / 32] |= (1 << (types[i] % 32));
return ret;
}