From: Youness Alaoui Date: Tue, 8 Apr 2014 03:14:42 +0000 (-0400) Subject: Only check selected pair for writability in gio outputstream X-Git-Tag: 0.1.8~229 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=390fb717ad38ea2cccfd1512b6b5f1b5774bcdd7;p=platform%2Fupstream%2Flibnice.git Only check selected pair for writability in gio outputstream --- 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); } }