diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-16 21:55:13 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-16 21:55:13 +0100 |
commit | dd5a385e16168f9d4fe43dde53e49b77a15afa6e (patch) | |
tree | cceccebe61875948fd84963b8cdc836fa94be42a /src/cadet/gnunet-service-cadet-new_channel.c | |
parent | a8948252a3d4432018af33221db82ef2b8cde41b (diff) | |
download | gnunet-dd5a385e16168f9d4fe43dde53e49b77a15afa6e.tar.gz gnunet-dd5a385e16168f9d4fe43dde53e49b77a15afa6e.zip |
properly clean up unbound channels
Diffstat (limited to 'src/cadet/gnunet-service-cadet-new_channel.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet-new_channel.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index fe3faef5a..9d9edc28d 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c | |||
@@ -1044,7 +1044,10 @@ GCCH_channel_local_destroy (struct CadetChannel *ch, | |||
1044 | return; | 1044 | return; |
1045 | } | 1045 | } |
1046 | /* If the we ever sent the CHANNEL_CREATE, we need to send a destroy message. */ | 1046 | /* If the we ever sent the CHANNEL_CREATE, we need to send a destroy message. */ |
1047 | if (CADET_CHANNEL_NEW != ch->state) | 1047 | if (CADET_CHANNEL_NEW == ch->state) |
1048 | GSC_drop_loose_channel (&ch->port, | ||
1049 | ch); | ||
1050 | else | ||
1048 | GCT_send_channel_destroy (ch->t, | 1051 | GCT_send_channel_destroy (ch->t, |
1049 | ch->ctn); | 1052 | ch->ctn); |
1050 | /* Nothing left to do, just finish destruction */ | 1053 | /* Nothing left to do, just finish destruction */ |
@@ -1710,6 +1713,11 @@ GCCH_handle_local_data (struct CadetChannel *ch, | |||
1710 | GNUNET_break (0); | 1713 | GNUNET_break (0); |
1711 | return GNUNET_SYSERR; | 1714 | return GNUNET_SYSERR; |
1712 | } | 1715 | } |
1716 | if (GNUNET_YES == ch->destroy) | ||
1717 | { | ||
1718 | /* we are going down, drop messages */ | ||
1719 | return GNUNET_OK; | ||
1720 | } | ||
1713 | ch->pending_messages++; | 1721 | ch->pending_messages++; |
1714 | 1722 | ||
1715 | if (GNUNET_YES == ch->is_loopback) | 1723 | if (GNUNET_YES == ch->is_loopback) |
@@ -1722,19 +1730,25 @@ GCCH_handle_local_data (struct CadetChannel *ch, | |||
1722 | env = GNUNET_MQ_msg_extra (ld, | 1730 | env = GNUNET_MQ_msg_extra (ld, |
1723 | buf_len, | 1731 | buf_len, |
1724 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); | 1732 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); |
1725 | if (sender_ccn.channel_of_client == | 1733 | if ( (NULL != ch->owner) && |
1726 | ch->owner->ccn.channel_of_client) | 1734 | (sender_ccn.channel_of_client == |
1735 | ch->owner->ccn.channel_of_client) ) | ||
1727 | { | 1736 | { |
1728 | receiver = ch->dest; | 1737 | receiver = ch->dest; |
1729 | to_owner = GNUNET_NO; | 1738 | to_owner = GNUNET_NO; |
1730 | } | 1739 | } |
1731 | else | 1740 | else if ( (NULL != ch->dest) && |
1741 | (sender_ccn.channel_of_client == | ||
1742 | ch->dest->ccn.channel_of_client) ) | ||
1732 | { | 1743 | { |
1733 | GNUNET_assert (sender_ccn.channel_of_client == | ||
1734 | ch->dest->ccn.channel_of_client); | ||
1735 | receiver = ch->owner; | 1744 | receiver = ch->owner; |
1736 | to_owner = GNUNET_YES; | 1745 | to_owner = GNUNET_YES; |
1737 | } | 1746 | } |
1747 | else | ||
1748 | { | ||
1749 | GNUNET_break (0); | ||
1750 | return GNUNET_SYSERR; | ||
1751 | } | ||
1738 | ld->ccn = receiver->ccn; | 1752 | ld->ccn = receiver->ccn; |
1739 | GNUNET_memcpy (&ld[1], | 1753 | GNUNET_memcpy (&ld[1], |
1740 | buf, | 1754 | buf, |