summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-12 20:12:28 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-12 20:12:28 +0000
commitbc2da28e8bfac47c9a0b0529a487369daff066a0 (patch)
treedf0c37c4b12d74f88fb81b89647c3dac8d6c3e81 /src
parent19e987c3c98dbbdcabd59c333164571e0c53744a (diff)
-fix leak on transmission error in combination with disconnect
Diffstat (limited to 'src')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index c44afa91e..404dadb80 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1224,13 +1224,20 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
static void
transmit_send_continuation (void *cls,
const struct GNUNET_PeerIdentity *receiver,
- int success, size_t size_payload, size_t physical)
+ int success,
+ size_t size_payload,
+ size_t physical)
{
struct MessageQueue *mq = cls;
struct NeighbourMapEntry *n;
if (NULL == (n = lookup_neighbour (receiver)))
{
+ if (NULL != mq->cont)
+ mq->cont (mq->cont_cls,
+ GNUNET_SYSERR /* not connected */,
+ size_payload,
+ 0);
GNUNET_free (mq);
return; /* disconnect or other error while transmitting, can happen */
}
@@ -1255,7 +1262,6 @@ transmit_send_continuation (void *cls,
GNUNET_break (0);
}
-
GNUNET_break (size_payload == mq->message_buf_size);
bytes_in_send_queue -= mq->message_buf_size;
GNUNET_STATISTICS_set (GST_stats,
@@ -1327,9 +1333,9 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
if (timeout.rel_value_us > 0)
break;
GNUNET_STATISTICS_update (GST_stats,
- gettext_noop
- ("# messages timed out while in transport queue"),
- 1, GNUNET_NO);
+ gettext_noop ("# messages timed out while in transport queue"),
+ 1,
+ GNUNET_NO);
GNUNET_CONTAINER_DLL_remove (n->messages_head,
n->messages_tail,
mq);