summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno Cabral <bcabral@uw.edu>2014-08-31 14:58:43 +0000
committerBruno Cabral <bcabral@uw.edu>2014-08-31 14:58:43 +0000
commit937abe2f277d163e19b626fc37955d91e5126140 (patch)
treefba7ca533d8cd828e9064ebb9927e0184aa26e0a /src
parent940c02e4903e957db965991c58be73e3400e31b0 (diff)
Fix infinite loop ( grothoff, please check !)
Diffstat (limited to 'src')
-rw-r--r--src/cadet/cadet_api.c7
-rw-r--r--src/fs/gnunet-service-fs_cadet_client.c9
-rw-r--r--src/include/gnunet_cadet_service.h12
3 files changed, 28 insertions, 0 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index c65475b10..5cb42286e 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -1758,6 +1758,13 @@ GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel, int co
void
+GNUNET_CADET_cancel_notify (struct GNUNET_CADET_TransmitHandle *th)
+{
+ th->notify = NULL;
+}
+
+
+void
GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle *th)
{
struct GNUNET_CADET_Handle *cadet;
diff --git a/src/fs/gnunet-service-fs_cadet_client.c b/src/fs/gnunet-service-fs_cadet_client.c
index dde7aba48..aa2c0c426 100644
--- a/src/fs/gnunet-service-fs_cadet_client.c
+++ b/src/fs/gnunet-service-fs_cadet_client.c
@@ -219,8 +219,17 @@ reset_cadet (struct CadetHandle *mh)
"Resetting cadet channel to %s\n",
GNUNET_i2s (&mh->target));
mh->channel = NULL;
+
if (NULL != channel)
+ {
+ /* Avoid loop */
+ if ( NULL != mh->wh)
+ {
+ GNUNET_CADET_cancel_notify(mh->wh);
+ mh->wh = NULL;
+ }
GNUNET_CADET_channel_destroy (channel);
+ }
GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
&move_to_pending,
mh);
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h
index 14826c40b..a4ac42eb8 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -348,6 +348,18 @@ void
GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle
*th);
+
+/**
+ * Cancel only the notify without cleaning the structs to a futher call to channel destroy
+ *
+ * @param th handle that was returned by "notify_transmit_ready".
+ */
+void
+GNUNET_CADET_cancel_notify (struct GNUNET_CADET_TransmitHandle
+ *th);
+
+
+
/**
* Indicate readiness to receive the next message on a channel.