summaryrefslogtreecommitdiff
path: root/src/rps/rps_api.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-10-11 16:33:17 +0200
committerJulius Bünger <buenger@mytum.de>2018-10-11 16:33:17 +0200
commitb5f74297733d8493881db455e234eeb3ee8cf9f9 (patch)
treed4c52d8996325ff435e44ddb5ca253a074fe6f7b /src/rps/rps_api.c
parent2408ee6b254b5f67a6b50280dec6c66536abd1c1 (diff)
RPS API: (Temporarily) Fix usage of stream request handles
Diffstat (limited to 'src/rps/rps_api.c')
-rw-r--r--src/rps/rps_api.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c
index 34b28cd6a..5c68e4337 100644
--- a/src/rps/rps_api.c
+++ b/src/rps/rps_api.c
@@ -434,12 +434,18 @@ void
GNUNET_RPS_stream_cancel (struct GNUNET_RPS_StreamRequestHandle *srh)
{
struct GNUNET_RPS_Handle *rps_handle;
+ struct GNUNET_RPS_StreamRequestHandle *srh_iter;
rps_handle = srh->rps_handle;
- GNUNET_CONTAINER_DLL_remove (rps_handle->stream_requests_head,
- rps_handle->stream_requests_tail,
- srh);
- GNUNET_free (srh);
+ srh_iter = rps_handle->stream_requests_head;
+ while (NULL != srh_iter && srh_iter != srh) srh_iter = srh_iter->next;
+ if (NULL != srh_iter)
+ {
+ GNUNET_CONTAINER_DLL_remove (rps_handle->stream_requests_head,
+ rps_handle->stream_requests_tail,
+ srh);
+ GNUNET_free (srh);
+ }
if (NULL == rps_handle->stream_requests_head) cancel_stream (rps_handle);
}
@@ -542,6 +548,9 @@ handle_stream_input (void *cls,
NULL != srh_iter;
srh_iter = srh_iter->next)
{
+ GNUNET_CONTAINER_DLL_remove (srh_head_tmp,
+ srh_tail_tmp,
+ srh_iter);
GNUNET_CONTAINER_DLL_insert (h->stream_requests_head,
h->stream_requests_tail,
srh_iter);
@@ -928,17 +937,27 @@ GNUNET_RPS_request_cancel (struct GNUNET_RPS_Request_Handle *rh)
void
GNUNET_RPS_disconnect (struct GNUNET_RPS_Handle *h)
{
- GNUNET_MQ_destroy (h->mq);
if (NULL != h->stream_requests_head)
{
+ struct GNUNET_RPS_StreamRequestHandle *srh_iter;
+
LOG (GNUNET_ERROR_TYPE_WARNING,
"Still waiting for replies\n");
+ srh_iter = h->stream_requests_head;
+ while (NULL != srh_iter)
+ {
+ struct GNUNET_RPS_StreamRequestHandle *srh_tmp = srh_iter;
+ srh_iter = srh_iter->next;
+ GNUNET_RPS_stream_cancel (srh_tmp);
+ }
}
if (NULL != h->view_update_cb)
{
LOG (GNUNET_ERROR_TYPE_WARNING,
"Still waiting for view updates\n");
+ GNUNET_RPS_view_request_cancel (h);
}
+ GNUNET_MQ_destroy (h->mq);
GNUNET_free (h);
}