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
ecca7064
Commit
ecca7064
authored
Oct 24, 2010
by
Marcus Lundblad
Committed by
Youness Alaoui
Dec 14, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OK, so nice_address_equal does not fullfill GCompareFunc, use custom lookup functions
parent
fe6ac77f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
15 deletions
+34
-15
socket/turn.c
socket/turn.c
+34
-15
No files found.
socket/turn.c
View file @
ecca7064
...
...
@@ -337,17 +337,31 @@ stun_message_ensure_ms_realm(StunMessage *msg, uint8_t *realm)
static
gboolean
priv_has_permission_for_peer
(
TurnPriv
*
priv
,
const
NiceAddress
*
to
)
{
GList
*
found
=
g_list_find_custom
(
priv
->
permissions
,
to
,
(
GCompareFunc
)
nice_address_equal
);
GList
*
iter
;
return
found
!=
NULL
;
for
(
iter
=
priv
->
permissions
;
iter
;
iter
=
g_list_next
(
iter
))
{
NiceAddress
*
address
=
(
NiceAddress
*
)
iter
->
data
;
if
(
nice_address_equal
(
address
,
to
))
return
TRUE
;
}
return
FALSE
;
}
static
gboolean
priv_has_sent_permission_for_peer
(
TurnPriv
*
priv
,
const
NiceAddress
*
to
)
{
return
g_list_find_custom
(
priv
->
sent_permissions
,
to
,
(
GCompareFunc
)
nice_address_equal
)
!=
NULL
;
GList
*
iter
;
for
(
iter
=
priv
->
sent_permissions
;
iter
;
iter
=
g_list_next
(
iter
))
{
NiceAddress
*
address
=
(
NiceAddress
*
)
iter
->
data
;
if
(
nice_address_equal
(
address
,
to
))
return
TRUE
;
}
return
FALSE
;
}
static
void
...
...
@@ -830,19 +844,22 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
nice_address_free
(
to
);
}
else
{
/* we now have a permission installed for this peer */
GList
*
sent_permission
=
g_list_find_custom
(
priv
->
sent_permissions
,
to
,
(
GCompareFunc
)
nice_address_equal
);
GList
*
iter
;
priv
->
permissions
=
g_list_append
(
priv
->
permissions
,
to
)
;
for
(
iter
=
priv
->
sent_permissions
;
iter
;
iter
=
g_list_next
(
iter
))
{
NiceAddress
*
address
=
(
NiceAddress
*
)
iter
->
data
;
if
(
sent_permission
)
{
nice_address_free
((
NiceAddress
*
)
sent_permission
->
data
);
priv
->
sent_permissions
=
g_list_remove_link
(
priv
->
sent_permissions
,
sent_permission
);
if
(
nice_address_equal
(
address
,
to
))
{
nice_address_free
((
NiceAddress
*
)
iter
->
data
);
priv
->
sent_permissions
=
g_list_remove_link
(
priv
->
sent_permissions
,
iter
);
break
;
}
}
priv
->
permissions
=
g_list_append
(
priv
->
permissions
,
to
);
/* install timer to schedule refresh of the permission */
/* (will not schedule refresh if we got an error) */
if
(
stun_message_get_class
(
&
msg
)
==
STUN_RESPONSE
&&
...
...
@@ -1178,8 +1195,10 @@ priv_send_create_permission(TurnPriv *priv, uint8_t *realm, gsize realm_len,
TURNMessage
*
msg
=
g_new0
(
TURNMessage
,
1
);
struct
sockaddr
addr
;
NiceAddress
*
to
=
nice_address_dup
(
peer
);
gchar
addr_str
[
NICE_ADDRESS_STRING_LEN
];
nice_debug
(
"creating CreatePermission message"
);
nice_address_to_string
(
to
,
addr_str
);
nice_debug
(
"creating CreatePermission message for %s"
,
addr_str
);
priv
->
sent_permissions
=
g_list_append
(
priv
->
sent_permissions
,
to
);
nice_address_copy_to_sockaddr
(
peer
,
&
addr
);
...
...
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