diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core_api.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c index afae20850..c1cfdb62f 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -784,7 +784,6 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
784 | const struct GNUNET_MQ_MessageHandler *handlers) | 784 | const struct GNUNET_MQ_MessageHandler *handlers) |
785 | { | 785 | { |
786 | struct GNUNET_CORE_Handle *h; | 786 | struct GNUNET_CORE_Handle *h; |
787 | unsigned int hcnt; | ||
788 | 787 | ||
789 | h = GNUNET_new (struct GNUNET_CORE_Handle); | 788 | h = GNUNET_new (struct GNUNET_CORE_Handle); |
790 | h->cfg = cfg; | 789 | h->cfg = cfg; |
@@ -794,18 +793,9 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
794 | h->disconnects = disconnects; | 793 | h->disconnects = disconnects; |
795 | h->peers = GNUNET_CONTAINER_multipeermap_create (128, | 794 | h->peers = GNUNET_CONTAINER_multipeermap_create (128, |
796 | GNUNET_NO); | 795 | GNUNET_NO); |
797 | hcnt = 0; | 796 | h->handlers = GNUNET_MQ_copy_handlers (handlers); |
798 | if (NULL != handlers) | 797 | h->hcnt = GNUNET_MQ_count_handlers (handlers); |
799 | while (NULL != handlers[hcnt].cb) | 798 | GNUNET_assert (h->hcnt < |
800 | hcnt++; | ||
801 | h->handlers = GNUNET_new_array (hcnt + 1, | ||
802 | struct GNUNET_MQ_MessageHandler); | ||
803 | if (NULL != handlers) | ||
804 | GNUNET_memcpy (h->handlers, | ||
805 | handlers, | ||
806 | hcnt * sizeof (struct GNUNET_MQ_MessageHandler)); | ||
807 | h->hcnt = hcnt; | ||
808 | GNUNET_assert (hcnt < | ||
809 | (GNUNET_SERVER_MAX_MESSAGE_SIZE - | 799 | (GNUNET_SERVER_MAX_MESSAGE_SIZE - |
810 | sizeof (struct InitMessage)) / sizeof (uint16_t)); | 800 | sizeof (struct InitMessage)) / sizeof (uint16_t)); |
811 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 801 | LOG (GNUNET_ERROR_TYPE_DEBUG, |