From: Bart Polot Date: Wed, 8 Feb 2017 18:41:41 +0000 (+0100) Subject: Fix open port, copy handlers for use on incoming channels X-Git-Tag: taler-0.2.1~190 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ec05b7e9cef7322f3291c96c278056f387ba574b;p=oweals%2Fgnunet.git Fix open port, copy handlers for use on incoming channels --- 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,