From ec05b7e9cef7322f3291c96c278056f387ba574b Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Wed, 8 Feb 2017 19:41:41 +0100 Subject: [PATCH] Fix open port, copy handlers for use on incoming channels --- src/cadet/cadet_api.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index e20796d17..7b9ac62b3 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -2538,7 +2538,16 @@ GNUNET_CADET_open_porT (struct GNUNET_CADET_Handle *h, p->cls = connects_cls; p->window_changes = window_changes; p->disconnects = disconnects; - p->handlers = handlers; + if (NULL != handlers) + { + unsigned int i; + for (i=0;NULL != handlers[i].cb; i++) ; + p->handlers = GNUNET_new_array (i + 1, + struct GNUNET_MQ_MessageHandler); + GNUNET_memcpy ((struct GNUNET_MQ_MessageHandler *) p->handlers, + handlers, + i * sizeof (struct GNUNET_MQ_MessageHandler)); + } GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (h->ports, -- 2.25.1