summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Adam <jakub.adam@ktknet.cz>2015-06-18 09:05:21 +0200
committerPhilip Withnall <philip.withnall@collabora.co.uk>2015-07-03 14:26:05 +0100
commite1f748cccacd81cce4db338d0203dc49bc915a30 (patch)
tree057cf7639bde5a2eeef9463a21d9f3b23a458dbd
parentcd61af3114a51df53619fb0460ace2b3660fc5da (diff)
downloadlibnice-e1f748cccacd81cce4db338d0203dc49bc915a30.tar.gz
conncheck: set writable callback to socket from TCP active connect
A new socket created in nice_tcp_active_socket_connect() should have its writable callback set, because it's possible for it to become a base socket of a peer reflexive candidate, if some is discovered by connection checks on that TCP active candidate. Previously, when such prflx candidate became selected, without write_cb on the socket the agent was never notified about it becoming writable again after the socket's buffer got filled up. This caused the data flow to hang permanently. Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Reviewed-by: Olivier CrĂȘte <olivier.crete@collabora.com> http://phabricator.freedesktop.org/T117
-rw-r--r--agent/agent-priv.h2
-rw-r--r--agent/agent.c2
-rw-r--r--agent/conncheck.c6
3 files changed, 9 insertions, 1 deletions
diff --git a/agent/agent-priv.h b/agent/agent-priv.h
index 7497cb1..f66a57e 100644
--- a/agent/agent-priv.h
+++ b/agent/agent-priv.h
@@ -220,6 +220,8 @@ void nice_agent_init_stun_agent (NiceAgent *agent, StunAgent *stun_agent);
void _priv_set_socket_tos (NiceAgent *agent, NiceSocket *sock, gint tos);
+void _tcp_sock_is_writable (NiceSocket *sock, gpointer user_data);
+
gboolean
component_io_cb (
GSocket *gsocket,
diff --git a/agent/agent.c b/agent/agent.c
index a2c475f..77450c3 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -1837,7 +1837,7 @@ adjust_tcp_clock (NiceAgent *agent, Stream *stream, Component *component)
}
}
-static void
+void
_tcp_sock_is_writable (NiceSocket *sock, gpointer user_data)
{
Component *component = user_data;
diff --git a/agent/conncheck.c b/agent/conncheck.c
index bed3465..33491bf 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -1914,6 +1914,12 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
if (new_socket) {
pair->sockptr = new_socket;
_priv_set_socket_tos (agent, pair->sockptr, stream2->tos);
+
+ if (agent->reliable) {
+ nice_socket_set_writable_callback (pair->sockptr,
+ _tcp_sock_is_writable, component2);
+ }
+
component_attach_socket (component2, new_socket);
}
}