Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
1949b89f
Commit
1949b89f
authored
Jan 15, 2016
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
component: Add API to cleanly remove a base socket
parent
93330f1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
6 deletions
+48
-6
agent/agent.c
agent/agent.c
+1
-1
agent/component.c
agent/component.c
+46
-3
agent/component.h
agent/component.h
+1
-2
No files found.
agent/agent.c
View file @
1949b89f
...
...
@@ -4872,7 +4872,7 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data)
stream
->
id
,
component
->
id
,
NICE_COMPONENT_STATE_FAILED
);
}
nice_component_
detach
_socket
(
component
,
socket_source
->
socket
);
nice_component_
remove
_socket
(
component
,
socket_source
->
socket
);
agent_unlock
();
g_object_unref
(
agent
);
return
G_SOURCE_REMOVE
;
...
...
agent/component.c
View file @
1949b89f
...
...
@@ -82,6 +82,10 @@ static void
nice_component_schedule_io_callback
(
NiceComponent
*
component
);
static
void
nice_component_deschedule_io_callback
(
NiceComponent
*
component
);
static
void
nice_component_detach_socket
(
NiceComponent
*
component
,
NiceSocket
*
nicesock
);
static
void
nice_component_clear_selected_pair
(
NiceComponent
*
component
);
void
...
...
@@ -152,6 +156,45 @@ nice_component_new (guint id, NiceAgent *agent, NiceStream *stream)
NULL
);
}
void
nice_component_remove_socket
(
NiceComponent
*
cmp
,
NiceSocket
*
nsocket
)
{
GSList
*
i
;
for
(
i
=
cmp
->
local_candidates
;
i
;)
{
NiceCandidate
*
candidate
=
i
->
data
;
GSList
*
next
=
i
->
next
;
if
(
!
nice_socket_is_based_on
(
candidate
->
sockptr
,
nsocket
))
{
i
=
next
;
continue
;
}
if
(
candidate
==
cmp
->
selected_pair
.
local
)
{
nice_component_clear_selected_pair
(
cmp
);
agent_signal_component_state_change
(
cmp
->
agent
,
cmp
->
stream
->
id
,
cmp
->
id
,
NICE_COMPONENT_STATE_FAILED
);
}
refresh_prune_candidate
(
cmp
->
agent
,
candidate
);
if
(
candidate
->
sockptr
!=
nsocket
)
{
discovery_prune_socket
(
cmp
->
agent
,
candidate
->
sockptr
);
conn_check_prune_socket
(
cmp
->
agent
,
cmp
->
stream
,
cmp
,
candidate
->
sockptr
);
nice_component_detach_socket
(
cmp
,
candidate
->
sockptr
);
}
agent_remove_local_candidate
(
cmp
->
agent
,
candidate
);
nice_candidate_free
(
candidate
);
cmp
->
local_candidates
=
g_slist_delete_link
(
cmp
->
local_candidates
,
i
);
i
=
next
;
}
discovery_prune_socket
(
cmp
->
agent
,
nsocket
);
conn_check_prune_socket
(
cmp
->
agent
,
cmp
->
stream
,
cmp
,
nsocket
);
nice_component_detach_socket
(
cmp
,
nsocket
);
}
void
nice_component_clean_turn_servers
(
NiceComponent
*
cmp
)
{
...
...
@@ -541,7 +584,7 @@ nice_component_reattach_all_sockets (NiceComponent *component)
/**
* nice_component_detach_socket:
* @component: a #Component
* @component: a #
Nice
Component
* @socket: the socket to detach the source for
*
* Detach the #GSource for the single specified @socket. It also closes it
...
...
@@ -549,7 +592,7 @@ nice_component_reattach_all_sockets (NiceComponent *component)
*
* If the @socket doesn’t exist in this @component, do nothing.
*/
void
static
void
nice_component_detach_socket
(
NiceComponent
*
component
,
NiceSocket
*
nicesock
)
{
GSList
*
l
;
...
...
@@ -1281,7 +1324,7 @@ static GSourceFuncs component_source_funcs = {
};
/**
* component_source_new:
*
nice_
component_source_new:
* @agent: a #NiceAgent
* @stream_id: The stream's id
* @component_id: The component's number
...
...
agent/component.h
View file @
1949b89f
...
...
@@ -261,8 +261,7 @@ void
nice_component_attach_socket
(
NiceComponent
*
component
,
NiceSocket
*
nsocket
);
void
nice_component_detach_socket
(
NiceComponent
*
component
,
NiceSocket
*
nsocket
);
nice_component_remove_socket
(
NiceComponent
*
component
,
NiceSocket
*
nsocket
);
void
nice_component_detach_all_sockets
(
NiceComponent
*
component
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment