Author: grothoff Date: 2008-02-20 23:29:18 -0700 (Wed, 20 Feb 2008) New Revision: 6399
Modified: GNUnet/src/util/network/select.c Log: optimize signaling Modified: GNUnet/src/util/network/select.c =================================================================== --- GNUnet/src/util/network/select.c 2008-02-21 05:50:08 UTC (rev 6398) +++ GNUnet/src/util/network/select.c 2008-02-21 06:29:18 UTC (rev 6399) @@ -377,8 +377,8 @@ #if DEBUG_SELECT GNUNET_GE_LOG (sh->ectx, GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_BULK, - "Sending %d bytes from session %p of select %p return %d.\n", - session->wapos - session->wspos, sh, session, ret); + "Sending %d bytes from session %p of select %s return %d.\n", + session->wapos - session->wspos, session, sh->description, ret); #endif if (ret == GNUNET_SYSERR) { @@ -1012,6 +1012,7 @@ unsigned short len; char *newBuffer; unsigned int newBufferSize; + int do_sig; #if DEBUG_SELECT GNUNET_GE_LOG (sh->ectx, @@ -1045,6 +1046,10 @@ GNUNET_mutex_unlock (sh->lock); return GNUNET_NO; } + if (session->wspos == session->wapos) + do_sig = GNUNET_YES; + else + do_sig = GNUNET_NO; if (session->wsize - session->wapos < len) { /* need to make space in some way or other */ @@ -1088,7 +1093,8 @@ if (mayBlock) session->no_read = GNUNET_YES; GNUNET_mutex_unlock (sh->lock); - signalSelect (sh); + if (do_sig) + signalSelect (sh); return GNUNET_OK; } _______________________________________________ GNUnet-SVN mailing list GNUnet-SVN@gnu.org http://lists.gnu.org/mailman/listinfo/gnunet-svn