}
+/**
+ * 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.
*
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
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 */
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)
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,