gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r12575 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r12575 - gnunet/src/util
Date: Mon, 16 Aug 2010 15:55:25 +0200

Author: grothoff
Date: 2010-08-16 15:55:25 +0200 (Mon, 16 Aug 2010)
New Revision: 12575

Modified:
   gnunet/src/util/connection.c
Log:
bughunting with assertions

Modified: gnunet/src/util/connection.c
===================================================================
--- gnunet/src/util/connection.c        2010-08-16 13:41:08 UTC (rev 12574)
+++ gnunet/src/util/connection.c        2010-08-16 13:55:25 UTC (rev 12575)
@@ -1328,7 +1328,7 @@
   used = sock->write_buffer_off - sock->write_buffer_pos;
   avail = sock->write_buffer_size - used;
   size = sock->nth.notify_size;
-  if (sock->nth.notify_size > avail)
+  if (size > avail)
     return GNUNET_NO;
   sock->nth.notify_ready = NULL;
   if (sock->write_buffer_size - sock->write_buffer_off < size)
@@ -1339,10 +1339,12 @@
       sock->write_buffer_off -= sock->write_buffer_pos;
       sock->write_buffer_pos = 0;
     }
-  GNUNET_assert (sock->write_buffer_size - sock->write_buffer_off >= size);
+  avail = sock->write_buffer_size - sock->write_buffer_off;
+  GNUNET_assert (avail >= size);
   size = notify (sock->nth.notify_ready_cls,
-                 sock->write_buffer_size - sock->write_buffer_off,
+                 avail,
                  &sock->write_buffer[sock->write_buffer_off]);
+  GNUNET_assert (size <= avail);
   sock->write_buffer_off += size;
   return GNUNET_YES;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]