From: Olivier CrĂȘte Date: Mon, 7 Jul 2014 20:01:49 +0000 (-0400) Subject: agent: Factor our writability signal X-Git-Tag: 0.1.8~132 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c57b0114525fc5b11e7dfddc037041c6e024a9b;p=platform%2Fupstream%2Flibnice.git agent: Factor our writability signal --- diff --git a/agent/agent.c b/agent/agent.c index 3c93340..9de4880 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -1308,6 +1308,16 @@ nice_agent_set_property ( } + +static void + agent_signal_socket_writable (NiceAgent *agent, Component *component) +{ + g_cancellable_cancel (component->tcp_writable_cancellable); + + agent_queue_signal (agent, signals[SIGNAL_RELIABLE_TRANSPORT_WRITABLE], + component->stream->id, component->id); +} + static void pseudo_tcp_socket_create (NiceAgent *agent, Stream *stream, Component *component) { @@ -1355,10 +1365,8 @@ pseudo_tcp_socket_opened (PseudoTcpSocket *sock, gpointer user_data) nice_debug ("Agent %p: s%d:%d pseudo Tcp socket Opened", agent, stream->id, component->id); - g_cancellable_cancel (component->tcp_writable_cancellable); - agent_queue_signal (agent, signals[SIGNAL_RELIABLE_TRANSPORT_WRITABLE], - stream->id, component->id); + agent_signal_socket_writable (agent, component); } /* Will attempt to queue all @n_messages into the pseudo-TCP transmission @@ -1614,9 +1622,8 @@ pseudo_tcp_socket_writable (PseudoTcpSocket *sock, gpointer user_data) nice_debug ("Agent %p: s%d:%d pseudo Tcp socket writable", agent, stream->id, component->id); - g_cancellable_cancel (component->tcp_writable_cancellable); - agent_queue_signal (agent, signals[SIGNAL_RELIABLE_TRANSPORT_WRITABLE], - stream->id, component->id); + + agent_signal_socket_writable (agent, component); } static void @@ -1749,9 +1756,7 @@ _tcp_sock_is_writable (NiceSocket *sock, gpointer user_data) nice_debug ("Agent %p: s%d:%d Tcp socket writable", agent, stream->id, component->id); - g_cancellable_cancel (component->tcp_writable_cancellable); - agent_queue_signal (agent, signals[SIGNAL_RELIABLE_TRANSPORT_WRITABLE], - stream->id, component->id); + agent_signal_socket_writable (agent, component); agent_unlock_and_emit (agent); } @@ -1971,8 +1976,7 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id, stream_id, component_id, lcandidate->foundation, rcandidate->foundation); if(agent->reliable && nice_socket_is_reliable (lcandidate->sockptr)) { - agent_queue_signal (agent, signals[SIGNAL_RELIABLE_TRANSPORT_WRITABLE], - stream_id, component_id); + agent_signal_socket_writable (agent, component); } }