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
a2a4b49e
Commit
a2a4b49e
authored
Feb 09, 2007
by
Dafydd Harries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nice_agent_remove_stream ()
darcs-hash:20070209142622-c9803-90f998b0f262523335a9866e669af8abea1b6504.gz
parent
b7fcf07e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
19 deletions
+122
-19
agent/Makefile.am
agent/Makefile.am
+2
-2
agent/agent.c
agent/agent.c
+63
-17
agent/agent.h
agent/agent.h
+5
-0
agent/test-add-remove-stream.c
agent/test-add-remove-stream.c
+51
-0
nice/libnice.symbols
nice/libnice.symbols
+1
-0
No files found.
agent/Makefile.am
View file @
a2a4b49e
...
@@ -29,7 +29,7 @@ libagent_la_LIBADD = \
...
@@ -29,7 +29,7 @@ libagent_la_LIBADD = \
check_PROGRAMS
=
\
check_PROGRAMS
=
\
test
\
test
\
test-add-stream
\
test-add-
remove-
stream
\
test-recv
\
test-recv
\
test-send
\
test-send
\
test-stun
\
test-stun
\
...
@@ -40,7 +40,7 @@ TESTS = $(check_PROGRAMS)
...
@@ -40,7 +40,7 @@ TESTS = $(check_PROGRAMS)
test_LDADD
=
libagent.la
$(GLIB_LIBS)
test_LDADD
=
libagent.la
$(GLIB_LIBS)
test_add_stream_LDADD
=
$(COMMON_LDADD)
test_add_
remove_
stream_LDADD
=
$(COMMON_LDADD)
test_recv_LDADD
=
$(COMMON_LDADD)
test_recv_LDADD
=
$(COMMON_LDADD)
...
...
agent/agent.c
View file @
a2a4b49e
...
@@ -242,6 +242,69 @@ nice_agent_add_stream (
...
@@ -242,6 +242,69 @@ nice_agent_add_stream (
}
}
static
Stream
*
_stream_lookup
(
NiceAgent
*
agent
,
guint
stream_id
)
{
GSList
*
i
;
for
(
i
=
agent
->
streams
;
i
;
i
=
i
->
next
)
{
Stream
*
s
=
i
->
data
;
if
(
s
->
id
==
stream_id
)
return
s
;
}
return
NULL
;
}
/**
* nice_agent_remove_stream:
* @agent: a NiceAgent
* @stream_id: the ID of the stream to remove
**/
void
nice_agent_remove_stream
(
NiceAgent
*
agent
,
guint
stream_id
)
{
/* note that streams/candidates can be in use by other threads */
Stream
*
stream
;
stream
=
_stream_lookup
(
agent
,
stream_id
);
if
(
!
stream
)
return
;
/* remove candidates */
{
GSList
*
i
;
GSList
*
candidates
=
agent
->
local_candidates
;
for
(
i
=
agent
->
local_candidates
;
i
;
i
=
i
->
next
)
{
NiceCandidate
*
candidate
=
i
->
data
;
if
(
candidate
->
stream_id
==
stream_id
)
{
candidates
=
g_slist_remove
(
candidates
,
candidate
);
nice_candidate_free
(
candidate
);
}
}
agent
->
local_candidates
=
candidates
;
}
/* remove stream */
stream_free
(
stream
);
agent
->
streams
=
g_slist_remove
(
agent
->
streams
,
stream
);
}
/**
/**
* nice_agent_add_local_address:
* nice_agent_add_local_address:
* @agent: A NiceAgent
* @agent: A NiceAgent
...
@@ -344,23 +407,6 @@ _local_candidate_lookup_by_fd (NiceAgent *agent, guint fd)
...
@@ -344,23 +407,6 @@ _local_candidate_lookup_by_fd (NiceAgent *agent, guint fd)
}
}
static
Stream
*
_stream_lookup
(
NiceAgent
*
agent
,
guint
stream_id
)
{
GSList
*
i
;
for
(
i
=
agent
->
streams
;
i
;
i
=
i
->
next
)
{
Stream
*
s
=
i
->
data
;
if
(
s
->
id
==
stream_id
)
return
s
;
}
return
NULL
;
}
static
void
static
void
_handle_stun_binding_request
(
_handle_stun_binding_request
(
NiceAgent
*
agent
,
NiceAgent
*
agent
,
...
...
agent/agent.h
View file @
a2a4b49e
...
@@ -46,6 +46,11 @@ nice_agent_add_stream (
...
@@ -46,6 +46,11 @@ nice_agent_add_stream (
NiceAgentRecvFunc
recv_func
,
NiceAgentRecvFunc
recv_func
,
gpointer
handle_recv_data
);
gpointer
handle_recv_data
);
void
nice_agent_remove_stream
(
NiceAgent
*
agent
,
guint
stream_id
);
void
void
nice_agent_free
(
NiceAgent
*
agent
);
nice_agent_free
(
NiceAgent
*
agent
);
...
...
agent/test-add-stream.c
→
agent/test-add-
remove-
stream.c
View file @
a2a4b49e
#include "agent.h"
#include "agent.h"
#include "udp-fake.h"
void
void
handle_recv
(
handle_recv
(
...
@@ -17,11 +18,32 @@ int
...
@@ -17,11 +18,32 @@ int
main
(
void
)
main
(
void
)
{
{
NiceAgent
*
agent
;
NiceAgent
*
agent
;
NiceAddress
addr
=
{
0
,};
NiceUDPSocketFactory
factory
;
nice_udp_fake_socket_factory_init
(
&
factory
);
if
(
!
nice_address_set_ipv4_from_string
(
&
addr
,
"127.0.0.1"
))
g_assert_not_reached
();
agent
=
nice_agent_new
(
&
factory
);
nice_agent_add_local_address
(
agent
,
&
addr
);
agent
=
nice_agent_new
(
NULL
);
g_assert
(
nice_agent_add_stream
(
agent
,
handle_recv
,
NULL
)
==
1
);
g_assert
(
nice_agent_add_stream
(
agent
,
handle_recv
,
NULL
)
==
1
);
g_assert
(
nice_agent_add_stream
(
agent
,
handle_recv
,
NULL
)
==
2
);
g_assert
(
nice_agent_add_stream
(
agent
,
handle_recv
,
NULL
)
==
2
);
g_assert
(
nice_agent_add_stream
(
agent
,
handle_recv
,
NULL
)
==
3
);
g_assert
(
nice_agent_add_stream
(
agent
,
handle_recv
,
NULL
)
==
3
);
g_assert
(
NULL
!=
agent
->
streams
);
g_assert
(
NULL
!=
agent
->
local_candidates
);
nice_agent_remove_stream
(
agent
,
1
);
nice_agent_remove_stream
(
agent
,
2
);
nice_agent_remove_stream
(
agent
,
3
);
g_assert
(
NULL
==
agent
->
streams
);
/* check no local candidates were left behind when streams were removed*/
g_assert
(
NULL
==
agent
->
local_candidates
);
nice_agent_free
(
agent
);
nice_agent_free
(
agent
);
return
0
;
return
0
;
...
...
nice/libnice.symbols
View file @
a2a4b49e
...
@@ -14,6 +14,7 @@ T nice_agent_get_local_candidates
...
@@ -14,6 +14,7 @@ T nice_agent_get_local_candidates
T nice_agent_new
T nice_agent_new
T nice_agent_poll_read
T nice_agent_poll_read
T nice_agent_recv
T nice_agent_recv
T nice_agent_remove_stream
T nice_agent_send
T nice_agent_send
T nice_candidate_free
T nice_candidate_free
T nice_candidate_ice_priority
T nice_candidate_ice_priority
...
...
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