From 30a3ad6332bea548ba14c2e80d648e481aab4fe3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 25 Jan 2017 09:51:54 +0100 Subject: fix crash if this end closed connection and other still sends data --- src/cadet/gnunet-service-cadet-new_channel.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/cadet/gnunet-service-cadet-new_channel.c') diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index 600b5be15..cc59ced52 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c @@ -1087,6 +1087,20 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch, size_t payload_size; GNUNET_assert (GNUNET_NO == ch->is_loopback); + if ( (GNUNET_YES == ch->destroy) && + (NULL == ch->owner) && + (NULL == ch->dest) ) + { + /* This client is gone, but we still have messages to send to + the other end (which is why @a ch is not yet dead). However, + we cannot pass messages to our client anymore. */ + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Dropping incoming payload on %s as this end is already closed\n", + GCCH_2s (ch)); + /* FIXME: send back ACK/NACK/Closed notification + to stop retransmissions! */ + return; + } payload_size = ntohs (msg->header.size) - sizeof (*msg); env = GNUNET_MQ_msg_extra (ld, payload_size, -- cgit v1.2.3