Commit f15b01a2 authored by Kai Vehmanen's avatar Kai Vehmanen

Refactored design for managing connectivity checks: now separate check lists...

Refactored design for managing connectivity checks: now separate check lists are maintained for each stream.

darcs-hash:20070911172014-77cd4-e39fb7b348b357df65781630179111f42eb87efd.gz
parent 94a2d5af
......@@ -44,10 +44,10 @@
#include <glib.h>
#include "agent.h"
#include "component.h"
#include "candidate.h"
#include "stream.h"
#include "conncheck.h"
#include "component.h"
#define NICE_AGENT_TIMER_TA_DEFAULT 20 /* timer Ta, msecs (impl. defined) */
#define NICE_AGENT_TIMER_TR_DEFAULT 15000 /* timer Tr, msecs (ICE ID-17) */
......@@ -83,9 +83,7 @@ struct _NiceAgent
GSList *discovery_list; /**< list of CandidateDiscovery items */
guint discovery_unsched_items; /**< number of discovery items unscheduled */
guint discovery_timer_id; /**< id of discovery timer */
GSList *conncheck_list; /**< list of CandidatePair items */
guint conncheck_timer_id; /**< id of discovery timer */
NiceCheckListState conncheck_state; /**< checklist state */
guint keepalive_timer_id; /**< id of keepalive timer */
guint64 tie_breaker; /**< tie breaker (ICE sect 5.2
"Determining Role" ID-17) */
......
......@@ -697,7 +697,7 @@ nice_agent_remove_stream (
return;
/* note: remove items with matching stream_ids from both lists */
conn_check_prune_stream (agent, stream_id);
conn_check_prune_stream (agent, stream);
discovery_prune_stream (agent, stream_id);
/* remove the stream itself */
......@@ -1410,7 +1410,6 @@ nice_agent_dispose (GObject *object)
/* step: free resources for the connectivity check timers */
conn_check_free (agent);
g_assert (agent->conncheck_list == NULL);
priv_remove_keepalive_timer (agent);
......@@ -1623,17 +1622,18 @@ nice_agent_set_selected_pair (
const gchar *rfoundation)
{
Component *component;
Stream *stream;
CandidatePair pair;
/* step: check that params specify an existing pair */
if (!agent_find_component (agent, stream_id, component_id, NULL, &component))
if (!agent_find_component (agent, stream_id, component_id, &stream, &component))
return FALSE;
if (!component_find_pair (component, agent, lfoundation, rfoundation, &pair))
return FALSE;
/* step: stop connectivity checks (note: for the whole stream) */
conn_check_prune_stream (agent, stream_id);
conn_check_prune_stream (agent, stream);
/* step: change component state */
agent_signal_component_state_change (agent, stream_id, component_id, NICE_COMPONENT_STATE_READY);
......
This diff is collapsed.
......@@ -58,6 +58,8 @@ typedef enum
NICE_CHECK_DISCOVERED /**< a valid candidate pair not on check list */
} NiceCheckState;
#if 0
/* XXX: move to stream.h */
typedef enum
{
NICE_CHECKLIST_NOT_STARTED = 1,
......@@ -65,6 +67,7 @@ typedef enum
NICE_CHECKLIST_COMPLETED,
NICE_CHECKLIST_FAILED
} NiceCheckListState;
#endif
typedef struct _CandidateCheckPair CandidateCheckPair;
......@@ -90,7 +93,7 @@ void conn_check_free_item (gpointer data, gpointer user_data);
void conn_check_free (NiceAgent *agent);
void conn_check_schedule_next (NiceAgent *agent);
int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair);
gboolean conn_check_prune_stream (NiceAgent *agent, guint stream_id);
gboolean conn_check_prune_stream (NiceAgent *agent, Stream *stream);
gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Component *component, NiceUDPSocket *udp_socket, const NiceAddress *from, gchar *buf, guint len);
gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair *b);
......
......@@ -52,6 +52,18 @@ G_BEGIN_DECLS
#define NICE_STREAM_DEF_UFRAG 4 + 1
#define NICE_STREAM_DEF_PWD 22 + 1
/**
* Checklist states. These match the definition given in
* the ICE spec sect 5.7.4. "Computing States" (ID-17).
*/
typedef enum
{
NICE_CHECKLIST_NOT_STARTED = 1,
NICE_CHECKLIST_RUNNING,
NICE_CHECKLIST_COMPLETED,
NICE_CHECKLIST_FAILED
} NiceCheckListState;
typedef struct _Stream Stream;
struct _Stream
......@@ -60,6 +72,8 @@ struct _Stream
guint n_components;
gboolean initial_binding_request_received;
GSList *components; /* list of 'Component' structs */
GSList *conncheck_list; /**< list of CandidatePair items */
NiceCheckListState conncheck_state; /**< checklist state */
gchar local_ufrag[NICE_STREAM_MAX_UFRAG];
gchar local_password[NICE_STREAM_MAX_PWD];
gchar remote_ufrag[NICE_STREAM_MAX_UFRAG];
......
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