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
59942464
Commit
59942464
authored
Oct 08, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add multiple bindings to a list and process them once we're done with the current binding
parent
1ef36087
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
4 deletions
+34
-4
socket/udp-turn.c
socket/udp-turn.c
+34
-4
No files found.
socket/udp-turn.c
View file @
59942464
...
...
@@ -74,6 +74,7 @@ typedef struct {
NiceAgent
*
nice
;
StunAgent
agent
;
GList
*
channels
;
GList
*
pending_bindings
;
ChannelBinding
*
current_binding
;
TURNMessage
*
current_binding_msg
;
GSource
*
tick_source
;
...
...
@@ -89,6 +90,21 @@ typedef struct {
static
void
priv_schedule_tick
(
turn_priv
*
priv
);
static
gboolean
priv_add_channel_binding
(
turn_priv
*
priv
,
NiceAddress
*
peer
);
static
void
priv_process_pending_bindings
(
turn_priv
*
priv
)
{
gboolean
ret
=
FALSE
;
while
(
priv
->
pending_bindings
!=
NULL
&&
ret
==
FALSE
)
{
NiceAddress
*
peer
=
priv
->
pending_bindings
->
data
;
ret
=
priv_add_channel_binding
(
priv
,
peer
);
priv
->
pending_bindings
=
g_list_remove
(
priv
->
pending_bindings
,
peer
);
g_free
(
peer
);
}
}
static
gboolean
priv_retransmissions_tick_unlocked
(
turn_priv
*
priv
)
...
...
@@ -102,6 +118,7 @@ priv_retransmissions_tick_unlocked (turn_priv *priv)
priv
->
current_binding
=
NULL
;
g_free
(
priv
->
current_binding_msg
);
priv
->
current_binding_msg
=
NULL
;
priv_process_pending_bindings
(
priv
);
break
;
case
0
:
/* Retransmit */
...
...
@@ -244,17 +261,21 @@ priv_send_channel_bind (turn_priv *priv, StunMessage *resp,
g_free
(
msg
);
return
FALSE
;
}
NICEAPI_EXPORT
gboolean
nice_udp_turn_socket_set_peer
(
NiceSocket
*
sock
,
NiceAddress
*
peer
)
static
gboolean
priv_add_channel_binding
(
turn_priv
*
priv
,
NiceAddress
*
peer
)
{
turn_priv
*
priv
=
(
turn_priv
*
)
sock
->
priv
;
size_t
stun_len
;
struct
sockaddr_storage
sa
;
nice_address_copy_to_sockaddr
(
peer
,
(
struct
sockaddr
*
)
&
sa
);
if
(
priv
->
current_binding
)
if
(
priv
->
current_binding
)
{
NiceAddress
*
pending
=
g_new0
(
NiceAddress
,
1
);
*
pending
=
*
peer
;
priv
->
pending_bindings
=
g_list_append
(
priv
->
pending_bindings
,
pending
);
return
FALSE
;
}
if
(
priv
->
compatibility
==
NICE_UDP_TURN_SOCKET_COMPATIBILITY_DRAFT9
)
{
uint16_t
channel
=
0x4000
;
...
...
@@ -331,6 +352,13 @@ nice_udp_turn_socket_set_peer (NiceSocket *sock, NiceAddress *peer)
return
FALSE
;
}
NICEAPI_EXPORT
gboolean
nice_udp_turn_socket_set_peer
(
NiceSocket
*
sock
,
NiceAddress
*
peer
)
{
turn_priv
*
priv
=
(
turn_priv
*
)
sock
->
priv
;
return
priv_add_channel_binding
(
priv
,
peer
);
}
gint
nice_udp_turn_socket_parse_recv
(
...
...
@@ -399,6 +427,7 @@ nice_udp_turn_socket_parse_recv (
priv
->
channels
=
g_list_append
(
priv
->
channels
,
priv
->
current_binding
);
priv
->
current_binding
=
NULL
;
}
priv_process_pending_bindings
(
priv
);
return
0
;
}
else
if
(
stun_message_get_class
(
&
msg
)
==
STUN_INDICATION
&&
stun_message_get_method
(
&
msg
)
==
STUN_IND_DATA
)
{
...
...
@@ -466,6 +495,7 @@ nice_udp_turn_socket_parse_recv (
g_list_free
(
priv
->
channels
);
priv
->
channels
=
g_list_append
(
NULL
,
priv
->
current_binding
);
priv
->
current_binding
=
NULL
;
priv_process_pending_bindings
(
priv
);
}
return
0
;
...
...
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