[Pkg-telepathy-commits] [libnice] 86/265: agent: Always emit a readable callback when pseudo-TCP data arrives

Simon McVittie smcv at debian.org
Wed May 14 12:04:55 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository libnice.

commit d285b5a53fe2446dc6778c334b30a965d08bfb56
Author: Philip Withnall <philip.withnall at collabora.co.uk>
Date:   Thu Jan 9 18:06:19 2014 +0000

    agent: Always emit a readable callback when pseudo-TCP data arrives
    
    Previously, the pseudo-TCP implementation’s readable() callback would
    only be invoked when new data was received if it was enabled. The
    callback is enabled by reading all data from the TCP input buffer until
    EWOULDBLOCK is returned.
    
    Reading all that data is not possible if the client buffer is of a
    limited size, and can lead to livelocks if the client reads exactly the
    number of bytes in the TCP input buffer (i.e. its buffer size matches
    the TCP buffer fill level).
    
    Instead, always invoke the readable() callback. This might be slightly
    less performant, but the whole pseudo-TCP implementation is a shambles
    anyway, and the callbacks need removing, so why not?
---
 agent/pseudotcp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/agent/pseudotcp.c b/agent/pseudotcp.c
index 39e45ac..1c9a1b9 100644
--- a/agent/pseudotcp.c
+++ b/agent/pseudotcp.c
@@ -1461,7 +1461,10 @@ process(PseudoTcpSocket *self, Segment *seg)
 
   // If we have new data, notify the user
   if (bNewData && priv->bReadEnable) {
-    priv->bReadEnable = FALSE;
+    /* priv->bReadEnable = FALSE; — removed so that we’re always notified of
+     * incoming pseudo-TCP data, rather than having to read the entire buffer
+     * on each readable() callback before the next callback is enabled.
+     * (When client-provided buffers are small, this is not possible.) */
     if (priv->callbacks.PseudoTcpReadable)
       priv->callbacks.PseudoTcpReadable(self, priv->callbacks.user_data);
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git



More information about the Pkg-telepathy-commits mailing list