diff options
Diffstat (limited to 'src/vpn/gnunet-daemon-vpn.c')
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index a6d051e9c..bd5938604 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c | |||
@@ -282,7 +282,8 @@ send_pkt_to_peer_notify_callback (void *cls, size_t size, void *buf) | |||
282 | { | 282 | { |
283 | struct GNUNET_MESH_Tunnel **tunnel = cls; | 283 | struct GNUNET_MESH_Tunnel **tunnel = cls; |
284 | 284 | ||
285 | GNUNET_MESH_tunnel_set_data (*tunnel, NULL); | 285 | struct tunnel_state *ts = GNUNET_MESH_tunnel_get_data(*tunnel); |
286 | ts->th = NULL; | ||
286 | 287 | ||
287 | if (NULL != buf) | 288 | if (NULL != buf) |
288 | { | 289 | { |
@@ -310,7 +311,7 @@ send_pkt_to_peer_notify_callback (void *cls, size_t size, void *buf) | |||
310 | GNUNET_MESH_tunnel_set_head (*tunnel, head); | 311 | GNUNET_MESH_tunnel_set_head (*tunnel, head); |
311 | GNUNET_MESH_tunnel_set_tail (*tunnel, tail); | 312 | GNUNET_MESH_tunnel_set_tail (*tunnel, tail); |
312 | 313 | ||
313 | struct GNUNET_MESH_TransmitHandle *th = | 314 | ts->th = |
314 | GNUNET_MESH_notify_transmit_ready (*tunnel, | 315 | GNUNET_MESH_notify_transmit_ready (*tunnel, |
315 | GNUNET_NO, | 316 | GNUNET_NO, |
316 | 42, | 317 | 42, |
@@ -322,7 +323,6 @@ send_pkt_to_peer_notify_callback (void *cls, size_t size, void *buf) | |||
322 | element->cls); | 323 | element->cls); |
323 | 324 | ||
324 | /* save the handle */ | 325 | /* save the handle */ |
325 | GNUNET_MESH_tunnel_set_data (*tunnel, th); | ||
326 | GNUNET_free (element); | 326 | GNUNET_free (element); |
327 | } | 327 | } |
328 | GNUNET_free (cls); | 328 | GNUNET_free (cls); |
@@ -355,9 +355,10 @@ send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
355 | GNUNET_assert (NULL != tunnel); | 355 | GNUNET_assert (NULL != tunnel); |
356 | GNUNET_assert (NULL != *tunnel); | 356 | GNUNET_assert (NULL != *tunnel); |
357 | 357 | ||
358 | if (NULL == GNUNET_MESH_tunnel_get_data (*tunnel)) | 358 | struct tunnel_state *ts = GNUNET_MESH_tunnel_get_data(*tunnel); |
359 | if (NULL == ts->th) | ||
359 | { | 360 | { |
360 | struct GNUNET_MESH_TransmitHandle *th = | 361 | ts->th = |
361 | GNUNET_MESH_notify_transmit_ready (*tunnel, | 362 | GNUNET_MESH_notify_transmit_ready (*tunnel, |
362 | GNUNET_NO, | 363 | GNUNET_NO, |
363 | 42, | 364 | 42, |
@@ -368,8 +369,6 @@ send_pkt_to_peer (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
368 | ntohs (hdr->size), | 369 | ntohs (hdr->size), |
369 | send_pkt_to_peer_notify_callback, | 370 | send_pkt_to_peer_notify_callback, |
370 | cls); | 371 | cls); |
371 | |||
372 | GNUNET_MESH_tunnel_set_data (*tunnel, th); | ||
373 | } | 372 | } |
374 | else | 373 | else |
375 | { | 374 | { |
@@ -882,8 +881,9 @@ receive_udp_back (void *cls | |||
882 | struct remote_addr *s = (struct remote_addr *) desc; | 881 | struct remote_addr *s = (struct remote_addr *) desc; |
883 | struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1); | 882 | struct udp_pkt *pkt = (struct udp_pkt *) (desc + 1); |
884 | const struct GNUNET_PeerIdentity *other = GNUNET_MESH_get_peer (tunnel); | 883 | const struct GNUNET_PeerIdentity *other = GNUNET_MESH_get_peer (tunnel); |
884 | struct tunnel_state *ts = GNUNET_MESH_tunnel_get_data(tunnel); | ||
885 | 885 | ||
886 | if (16 == s->addrlen) | 886 | if (16 == ts->addrlen) |
887 | { | 887 | { |
888 | size_t size = | 888 | size_t size = |
889 | sizeof (struct ip6_udp) + ntohs (pkt->len) - 1 - | 889 | sizeof (struct ip6_udp) + ntohs (pkt->len) - 1 - |
@@ -1063,6 +1063,7 @@ receive_tcp_back (void *cls | |||
1063 | struct remote_addr *s = (struct remote_addr *) desc; | 1063 | struct remote_addr *s = (struct remote_addr *) desc; |
1064 | struct tcp_pkt *pkt = (struct tcp_pkt *) (desc + 1); | 1064 | struct tcp_pkt *pkt = (struct tcp_pkt *) (desc + 1); |
1065 | const struct GNUNET_PeerIdentity *other = GNUNET_MESH_get_peer (tunnel); | 1065 | const struct GNUNET_PeerIdentity *other = GNUNET_MESH_get_peer (tunnel); |
1066 | struct tunnel_state *ts = GNUNET_MESH_tunnel_get_data(tunnel); | ||
1066 | 1067 | ||
1067 | size_t pktlen = | 1068 | size_t pktlen = |
1068 | ntohs (message->size) - sizeof (struct GNUNET_MessageHeader) - | 1069 | ntohs (message->size) - sizeof (struct GNUNET_MessageHeader) - |
@@ -1071,7 +1072,7 @@ receive_tcp_back (void *cls | |||
1071 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received TCP-Packet back, addrlen = %d\n", s->addrlen); | 1072 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received TCP-Packet back, addrlen = %d\n", s->addrlen); |
1072 | 1073 | ||
1073 | if (ntohs(message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP_BACK || | 1074 | if (ntohs(message->type) == GNUNET_MESSAGE_TYPE_VPN_SERVICE_TCP_BACK || |
1074 | s->addrlen == 16) | 1075 | ts->addrlen == 16) |
1075 | { | 1076 | { |
1076 | size_t size = pktlen + sizeof (struct ip6_tcp) - 1; | 1077 | size_t size = pktlen + sizeof (struct ip6_tcp) - 1; |
1077 | 1078 | ||