From 390fb717ad38ea2cccfd1512b6b5f1b5774bcdd7 Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Mon, 7 Apr 2014 23:14:42 -0400 Subject: [PATCH] Only check selected pair for writability in gio outputstream --- agent/outputstream.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/agent/outputstream.c b/agent/outputstream.c index c92b64d..8390ce9 100644 --- a/agent/outputstream.c +++ b/agent/outputstream.c @@ -470,7 +470,6 @@ nice_output_stream_is_writable (GPollableOutputStream *stream) Component *component = NULL; Stream *_stream = NULL; gboolean retval = FALSE; - GSList *i; NiceAgent *agent; /* owned */ /* Closed streams are not writeable. */ @@ -491,23 +490,15 @@ nice_output_stream_is_writable (GPollableOutputStream *stream) goto done; } if (component->selected_pair.local != NULL) { + NiceSocket *sockptr = component->selected_pair.local->sockptr; + /* If it’s a reliable agent, see if there’s any space in the pseudo-TCP * output buffer. */ - if (!nice_socket_is_reliable (component->selected_pair.local->sockptr) && - component->tcp != NULL) { - retval = pseudo_tcp_socket_can_send (component->tcp); - goto done; - } - - /* Check whether any of the component’s FDs are pollable. */ - for (i = component->socket_sources; i != NULL; i = i->next) { - SocketSource *socket_source = i->data; - NiceSocket *nicesock = socket_source->socket; - - if (g_socket_condition_check (nicesock->fileno, G_IO_OUT) != 0) { - retval = TRUE; - break; - } + if (!nice_socket_is_reliable (sockptr)) { + if (component->tcp != NULL) + retval = pseudo_tcp_socket_can_send (component->tcp); + } else { + retval = (g_socket_condition_check (sockptr->fileno, G_IO_OUT) != 0); } } -- 2.7.4