diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-23 13:51:43 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-23 13:51:43 +0000 |
commit | b0f5a7b53015ad3de87da115c940ba92f6143116 (patch) | |
tree | a3d7b93f7391debd99efb76fd017008cde3c78a6 /src/core | |
parent | 6ec2adf77b7c08ee8c427e38338dd39500cfa7f3 (diff) | |
download | gnunet-b0f5a7b53015ad3de87da115c940ba92f6143116.tar.gz gnunet-b0f5a7b53015ad3de87da115c940ba92f6143116.zip |
possibly fixing 1840 and/or related issues
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/gnunet-service-core_sessions.c | 14 | ||||
-rw-r--r-- | src/core/gnunet-service-core_typemap.c | 12 | ||||
-rw-r--r-- | src/core/gnunet-service-core_typemap.h | 8 |
3 files changed, 25 insertions, 9 deletions
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index 61532ac9c..f159da205 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c | |||
@@ -200,11 +200,8 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid) | |||
200 | gettext_noop ("# entries in session map"), | 200 | gettext_noop ("# entries in session map"), |
201 | GNUNET_CONTAINER_multihashmap_size (sessions), | 201 | GNUNET_CONTAINER_multihashmap_size (sessions), |
202 | GNUNET_NO); | 202 | GNUNET_NO); |
203 | if (NULL != session->tmap) | 203 | GSC_TYPEMAP_destroy (session->tmap); |
204 | { | 204 | session->tmap = NULL; |
205 | GSC_TYPEMAP_destroy (session->tmap); | ||
206 | session->tmap = NULL; | ||
207 | } | ||
208 | GNUNET_free (session); | 205 | GNUNET_free (session); |
209 | } | 206 | } |
210 | 207 | ||
@@ -260,6 +257,7 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, | |||
260 | "Creating session for peer `%4s'\n", GNUNET_i2s (peer)); | 257 | "Creating session for peer `%4s'\n", GNUNET_i2s (peer)); |
261 | #endif | 258 | #endif |
262 | session = GNUNET_malloc (sizeof (struct Session)); | 259 | session = GNUNET_malloc (sizeof (struct Session)); |
260 | session->tmap = GSC_TYPEMAP_create (); | ||
263 | session->peer = *peer; | 261 | session->peer = *peer; |
264 | session->kxinfo = kx; | 262 | session->kxinfo = kx; |
265 | session->time_established = GNUNET_TIME_absolute_get (); | 263 | session->time_established = GNUNET_TIME_absolute_get (); |
@@ -767,8 +765,7 @@ GSC_SESSIONS_set_typemap (const struct GNUNET_PeerIdentity *peer, | |||
767 | NULL, 0, /* FIXME: ATS */ | 765 | NULL, 0, /* FIXME: ATS */ |
768 | session->tmap, | 766 | session->tmap, |
769 | nmap); | 767 | nmap); |
770 | if (NULL != session->tmap) | 768 | GSC_TYPEMAP_destroy (session->tmap); |
771 | GSC_TYPEMAP_destroy (session->tmap); | ||
772 | session->tmap = nmap; | 769 | session->tmap = nmap; |
773 | } | 770 | } |
774 | 771 | ||
@@ -802,8 +799,7 @@ GSC_SESSIONS_add_to_typemap (const struct GNUNET_PeerIdentity *peer, | |||
802 | NULL, 0, /* FIXME: ATS */ | 799 | NULL, 0, /* FIXME: ATS */ |
803 | session->tmap, | 800 | session->tmap, |
804 | nmap); | 801 | nmap); |
805 | if (NULL != session->tmap) | 802 | GSC_TYPEMAP_destroy (session->tmap); |
806 | GSC_TYPEMAP_destroy (session->tmap); | ||
807 | session->tmap = nmap; | 803 | session->tmap = nmap; |
808 | } | 804 | } |
809 | 805 | ||
diff --git a/src/core/gnunet-service-core_typemap.c b/src/core/gnunet-service-core_typemap.c index e4f75bd00..5d40820df 100644 --- a/src/core/gnunet-service-core_typemap.c +++ b/src/core/gnunet-service-core_typemap.c | |||
@@ -260,6 +260,18 @@ GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap, | |||
260 | 260 | ||
261 | 261 | ||
262 | /** | 262 | /** |
263 | * Create an empty type map. | ||
264 | * | ||
265 | * @param map a type map | ||
266 | */ | ||
267 | struct GSC_TypeMap * | ||
268 | GSC_TYPEMAP_create () | ||
269 | { | ||
270 | return GNUNET_malloc (sizeof (struct GSC_TypeMap)); | ||
271 | } | ||
272 | |||
273 | |||
274 | /** | ||
263 | * Free the given type map. | 275 | * Free the given type map. |
264 | * | 276 | * |
265 | * @param map a type map | 277 | * @param map a type map |
diff --git a/src/core/gnunet-service-core_typemap.h b/src/core/gnunet-service-core_typemap.h index 72eb5b566..d589c0b1c 100644 --- a/src/core/gnunet-service-core_typemap.h +++ b/src/core/gnunet-service-core_typemap.h | |||
@@ -98,6 +98,14 @@ GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap, | |||
98 | const uint16_t *types, | 98 | const uint16_t *types, |
99 | unsigned int tcnt); | 99 | unsigned int tcnt); |
100 | 100 | ||
101 | /** | ||
102 | * Create an empty type map. | ||
103 | * | ||
104 | * @param map a type map | ||
105 | */ | ||
106 | struct GSC_TypeMap * | ||
107 | GSC_TYPEMAP_create (void); | ||
108 | |||
101 | 109 | ||
102 | /** | 110 | /** |
103 | * Free the given type map. | 111 | * Free the given type map. |