diff options
author | Philipp Tölke <toelke@in.tum.de> | 2011-10-05 09:41:31 +0000 |
---|---|---|
committer | Philipp Tölke <toelke@in.tum.de> | 2011-10-05 09:41:31 +0000 |
commit | cc632e434054d618798957fcdb1804f69c8dfc78 (patch) | |
tree | fedd8fb9fc43ae4e538139724c0c12dcc3856157 /src | |
parent | 2478a8f68e5958994c2678484cd31843c05d4efd (diff) | |
download | gnunet-cc632e434054d618798957fcdb1804f69c8dfc78.tar.gz gnunet-cc632e434054d618798957fcdb1804f69c8dfc78.zip |
core gives a buf of NULL to indicate errors
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/mesh_api.c | 3 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.c | 24 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index 4b6731d3f..5bb7d1403 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -675,6 +675,9 @@ core_notify (void *cls, size_t size, void *buf) | |||
675 | struct notify_cls *ncls = cls; | 675 | struct notify_cls *ncls = cls; |
676 | struct GNUNET_MESH_Tunnel *tunnel = ncls->tunnel; | 676 | struct GNUNET_MESH_Tunnel *tunnel = ncls->tunnel; |
677 | 677 | ||
678 | if (NULL == buf) | ||
679 | return ncls->notify (ncls->notify_cls, 0, NULL); | ||
680 | |||
678 | tunnel->notify_handle = NULL; | 681 | tunnel->notify_handle = NULL; |
679 | struct tunnel_message *message = buf; | 682 | struct tunnel_message *message = buf; |
680 | void *cbuf = (void *) &message[1]; | 683 | void *cbuf = (void *) &message[1]; |
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index 9c944ebef..fbbffc9a1 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c | |||
@@ -283,15 +283,21 @@ send_pkt_to_peer_notify_callback (void *cls, size_t size, void *buf) | |||
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 | GNUNET_MESH_tunnel_set_data (*tunnel, NULL); |
286 | struct GNUNET_MessageHeader *hdr = | 286 | |
287 | (struct GNUNET_MessageHeader *) (tunnel + 1); | 287 | if (NULL != buf) |
288 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 288 | { |
289 | "send_pkt_to_peer_notify_callback: buf = %x; size = %u;\n", buf, | 289 | struct GNUNET_MessageHeader *hdr = |
290 | size); | 290 | (struct GNUNET_MessageHeader *) (tunnel + 1); |
291 | GNUNET_assert (size >= ntohs (hdr->size)); | 291 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
292 | memcpy (buf, hdr, ntohs (hdr->size)); | 292 | "send_pkt_to_peer_notify_callback: buf = %x; size = %u;\n", buf, |
293 | size = ntohs (hdr->size); | 293 | size); |
294 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent!\n"); | 294 | GNUNET_assert (size >= ntohs (hdr->size)); |
295 | memcpy (buf, hdr, ntohs (hdr->size)); | ||
296 | size = ntohs (hdr->size); | ||
297 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent!\n"); | ||
298 | } | ||
299 | else | ||
300 | size = 0; | ||
295 | 301 | ||
296 | if (NULL != GNUNET_MESH_tunnel_get_head (*tunnel)) | 302 | if (NULL != GNUNET_MESH_tunnel_get_head (*tunnel)) |
297 | { | 303 | { |