Commit 9d77c426 authored by Olivier Crête's avatar Olivier Crête

agent: Add "keepalive-conncheck" property to make keepalives be conncheck

This is to use keepalives to check if the connection is still ongoing. If
they don't get a reply, then we can assume that the connection has died.

This needs to not happen in the case of ICE-TCP.
parent 5f2a2dd6
......@@ -158,6 +158,7 @@ struct _NiceAgent
#endif
gchar *software_attribute; /* SOFTWARE attribute */
gboolean reliable; /* property: reliable */
gboolean keepalive_conncheck; /* property: keepalive_conncheck */
GQueue pending_signals;
guint16 rfc4571_expecting_length;
......
......@@ -110,6 +110,7 @@ enum
PROP_ICE_UDP,
PROP_ICE_TCP,
PROP_BYTESTREAM_TCP,
PROP_KEEPALIVE_CONNCHECK
};
......@@ -681,6 +682,30 @@ nice_agent_class_init (NiceAgentClass *klass)
FALSE,
G_PARAM_READABLE));
/**
* NiceAgent:keepalive-conncheck:
*
* Use binding requests as keepalives instead of binding
* indications. This means that the keepalives may time out which
* will change the component state to %NICE_COMPONENT_STATE_FAILED.
*
* Enabing this is a slight violation of RFC 5245 section 10 which
* recommends using Binding Indications for keepalives.
*
* This is always enabled if the compatibility mode is
* %NICE_COMPATIBILITY_GOOGLE.
*
* Since: 0.1.7
*/
g_object_class_install_property (gobject_class, PROP_KEEPALIVE_CONNCHECK,
g_param_spec_boolean (
"keepalive-conncheck",
"Use conncheck as keepalives",
"Use binding requests which require a reply as keepalives instead of "
"binding indications which don't.",
FALSE,
G_PARAM_READWRITE));
/* install signals */
/**
......@@ -1150,6 +1175,14 @@ nice_agent_get_property (
g_value_set_boolean (value, FALSE);
}
break;
case PROP_KEEPALIVE_CONNCHECK:
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE)
g_value_set_boolean (value, TRUE);
else
g_value_set_boolean (value, agent->keepalive_conncheck);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
......@@ -1300,6 +1333,11 @@ nice_agent_set_property (
case PROP_BYTESTREAM_TCP:
/* TODO: support bytestream mode and set property to writable */
break;
case PROP_KEEPALIVE_CONNCHECK:
agent->keepalive_conncheck = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
......
......@@ -576,7 +576,8 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
if (p->local->transport != NICE_CANDIDATE_TRANSPORT_UDP)
continue;
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE ||
agent->keepalive_conncheck) {
NiceCandidate *candidate_priority;
guint32 priority;
uint8_t uname[NICE_STREAM_MAX_UNAME];
......@@ -592,6 +593,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
NICE_CANDIDATE_TYPE_PEER_REFLEXIVE);
candidate_priority->transport = p->local->transport;
candidate_priority->component_id = p->local->component_id;
/* FIXME: This is not always jingle */
priority = nice_candidate_jingle_priority (candidate_priority);
nice_candidate_free (candidate_priority);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment