From 86290d22b2632f1cddeb5ae5756574d7f5dcae83 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 19 Aug 2010 13:13:45 +0000 Subject: [PATCH] fixing fun bug --- src/util/common_allocation.c | 4 ---- src/util/connection.c | 13 +++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 21c4690bf..92cbc9747 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c @@ -116,11 +116,7 @@ GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber) */ void * GNUNET_xrealloc_ (void *ptr, -#ifndef W32_MEM_LIMIT - const size_t n, -#else size_t n, -#endif const char *filename, int linenumber) { #ifdef W32_MEM_LIMIT diff --git a/src/util/connection.c b/src/util/connection.c index eb4fe99c2..9e789eb58 100644 --- a/src/util/connection.c +++ b/src/util/connection.c @@ -1504,6 +1504,13 @@ transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) return; /* connect failed for good, we're finished */ } GNUNET_assert (sock->write_buffer_off >= sock->write_buffer_pos); + if ( (sock->nth.notify_ready != NULL) && + (sock->write_buffer_size < sock->nth.notify_size) ) + { + sock->write_buffer = GNUNET_realloc(sock->write_buffer, + sock->nth.notify_size); + sock->write_buffer_size = sock->nth.notify_size; + } process_notify (sock); have = sock->write_buffer_off - sock->write_buffer_pos; if (have == 0) @@ -1592,12 +1599,6 @@ GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle return NULL; GNUNET_assert (notify != NULL); GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE); - if (sock->write_buffer_size < size) - { - sock->write_buffer = GNUNET_realloc(sock->write_buffer, size); - sock->write_buffer_size = size; - } - GNUNET_assert (sock->write_buffer_size >= size); GNUNET_assert (sock->write_buffer_off <= sock->write_buffer_size); GNUNET_assert (sock->write_buffer_pos <= sock->write_buffer_size); GNUNET_assert (sock->write_buffer_pos <= sock->write_buffer_off); -- 2.25.1