diff options
Diffstat (limited to 'src/nat/nat_api.c')
-rw-r--r-- | src/nat/nat_api.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nat/nat_api.c b/src/nat/nat_api.c index 3fe97ed85..481bc6fde 100644 --- a/src/nat/nat_api.c +++ b/src/nat/nat_api.c | |||
@@ -49,6 +49,11 @@ struct AddrEntry | |||
49 | struct AddrEntry *prev; | 49 | struct AddrEntry *prev; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Address class of the address. | ||
53 | */ | ||
54 | enum GNUNET_NAT_AddressClass ac; | ||
55 | |||
56 | /** | ||
52 | * Number of bytes that follow. | 57 | * Number of bytes that follow. |
53 | */ | 58 | */ |
54 | socklen_t addrlen; | 59 | socklen_t addrlen; |
@@ -130,11 +135,25 @@ do_connect (void *cls); | |||
130 | static void | 135 | static void |
131 | reconnect (struct GNUNET_NAT_Handle *nh) | 136 | reconnect (struct GNUNET_NAT_Handle *nh) |
132 | { | 137 | { |
138 | struct AddrEntry *ae; | ||
139 | |||
133 | if (NULL != nh->mq) | 140 | if (NULL != nh->mq) |
134 | { | 141 | { |
135 | GNUNET_MQ_destroy (nh->mq); | 142 | GNUNET_MQ_destroy (nh->mq); |
136 | nh->mq = NULL; | 143 | nh->mq = NULL; |
137 | } | 144 | } |
145 | while (NULL != (ae = nh->ae_head)) | ||
146 | { | ||
147 | GNUNET_CONTAINER_DLL_remove (nh->ae_head, | ||
148 | nh->ae_tail, | ||
149 | ae); | ||
150 | nh->address_callback (nh->callback_cls, | ||
151 | GNUNET_NO, | ||
152 | ae->ac, | ||
153 | (const struct sockaddr *) &ae[1], | ||
154 | ae->addrlen); | ||
155 | GNUNET_free (ae); | ||
156 | } | ||
138 | nh->reconnect_delay | 157 | nh->reconnect_delay |
139 | = GNUNET_TIME_STD_BACKOFF (nh->reconnect_delay); | 158 | = GNUNET_TIME_STD_BACKOFF (nh->reconnect_delay); |
140 | nh->reconnect_task | 159 | nh->reconnect_task |
@@ -260,6 +279,7 @@ handle_address_change_notification (void *cls, | |||
260 | if (GNUNET_YES == ntohl (acn->add_remove)) | 279 | if (GNUNET_YES == ntohl (acn->add_remove)) |
261 | { | 280 | { |
262 | ae = GNUNET_malloc (sizeof (*ae) + alen); | 281 | ae = GNUNET_malloc (sizeof (*ae) + alen); |
282 | ae->ac = ac; | ||
263 | ae->addrlen = alen; | 283 | ae->addrlen = alen; |
264 | GNUNET_memcpy (&ae[1], | 284 | GNUNET_memcpy (&ae[1], |
265 | sa, | 285 | sa, |