[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: properly clean up unbound c
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: properly clean up unbound channels |
Date: |
Thu, 16 Feb 2017 21:55:14 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new dd5a385e1 properly clean up unbound channels
dd5a385e1 is described below
commit dd5a385e16168f9d4fe43dde53e49b77a15afa6e
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Feb 16 21:55:13 2017 +0100
properly clean up unbound channels
---
src/cadet/gnunet-service-cadet-new.c | 18 ++++++++++++++++++
src/cadet/gnunet-service-cadet-new.h | 11 +++++++++++
src/cadet/gnunet-service-cadet-new_channel.c | 26 ++++++++++++++++++++------
3 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/src/cadet/gnunet-service-cadet-new.c
b/src/cadet/gnunet-service-cadet-new.c
index 55c7d1bdb..1f28745e1 100644
--- a/src/cadet/gnunet-service-cadet-new.c
+++ b/src/cadet/gnunet-service-cadet-new.c
@@ -1200,6 +1200,24 @@ GSC_handle_remote_channel_destroy (struct CadetClient *c,
/**
+ * A client that created a loose channel that was not bound to a port
+ * disconnected, drop it from the #loose_channels list.
+ *
+ * @param port the port the channel was trying to bind to
+ * @param ch the channel that was lost
+ */
+void
+GSC_drop_loose_channel (const struct GNUNET_HashCode *port,
+ struct CadetChannel *ch)
+{
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_CONTAINER_multihashmap_remove (loose_channels,
+ port,
+ ch));
+}
+
+
+/**
* Iterator for deleting each channel whose client endpoint disconnected.
*
* @param cls Closure (client that has disconnected).
diff --git a/src/cadet/gnunet-service-cadet-new.h
b/src/cadet/gnunet-service-cadet-new.h
index dff0d3c8c..bee5c67cc 100644
--- a/src/cadet/gnunet-service-cadet-new.h
+++ b/src/cadet/gnunet-service-cadet-new.h
@@ -264,6 +264,17 @@ GSC_handle_remote_channel_destroy (struct CadetClient *c,
struct GNUNET_CADET_ClientChannelNumber ccn,
struct CadetChannel *ch);
+/**
+ * A client that created a loose channel that was not bound to a port
+ * disconnected, drop it from the #loose_channels list.
+ *
+ * @param port the port the channel was trying to bind to
+ * @param ch the channel that was lost
+ */
+void
+GSC_drop_loose_channel (const struct GNUNET_HashCode *port,
+ struct CadetChannel *ch);
+
/**
* Bind incoming channel to this client, and notify client
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,
return;
}
/* If the we ever sent the CHANNEL_CREATE, we need to send a destroy
message. */
- if (CADET_CHANNEL_NEW != ch->state)
+ if (CADET_CHANNEL_NEW == ch->state)
+ GSC_drop_loose_channel (&ch->port,
+ ch);
+ else
GCT_send_channel_destroy (ch->t,
ch->ctn);
/* Nothing left to do, just finish destruction */
@@ -1710,6 +1713,11 @@ GCCH_handle_local_data (struct CadetChannel *ch,
GNUNET_break (0);
return GNUNET_SYSERR;
}
+ if (GNUNET_YES == ch->destroy)
+ {
+ /* we are going down, drop messages */
+ return GNUNET_OK;
+ }
ch->pending_messages++;
if (GNUNET_YES == ch->is_loopback)
@@ -1722,19 +1730,25 @@ GCCH_handle_local_data (struct CadetChannel *ch,
env = GNUNET_MQ_msg_extra (ld,
buf_len,
GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA);
- if (sender_ccn.channel_of_client ==
- ch->owner->ccn.channel_of_client)
+ if ( (NULL != ch->owner) &&
+ (sender_ccn.channel_of_client ==
+ ch->owner->ccn.channel_of_client) )
{
receiver = ch->dest;
to_owner = GNUNET_NO;
}
- else
+ else if ( (NULL != ch->dest) &&
+ (sender_ccn.channel_of_client ==
+ ch->dest->ccn.channel_of_client) )
{
- GNUNET_assert (sender_ccn.channel_of_client ==
- ch->dest->ccn.channel_of_client);
receiver = ch->owner;
to_owner = GNUNET_YES;
}
+ else
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
ld->ccn = receiver->ccn;
GNUNET_memcpy (&ld[1],
buf,
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: properly clean up unbound channels,
gnunet <=