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
9d070373
Commit
9d070373
authored
Mar 30, 2009
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change send_requests GList into a GQueue to allow a faster push_tail
parent
3bf02b0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
socket/turn.c
socket/turn.c
+10
-8
No files found.
socket/turn.c
View file @
9d070373
...
@@ -82,7 +82,7 @@ typedef struct {
...
@@ -82,7 +82,7 @@ typedef struct {
uint8_t
*
password
;
uint8_t
*
password
;
size_t
password_len
;
size_t
password_len
;
NiceTurnSocketCompatibility
compatibility
;
NiceTurnSocketCompatibility
compatibility
;
G
List
*
send_requests
;
G
Queue
*
send_requests
;
}
TurnPriv
;
}
TurnPriv
;
...
@@ -160,6 +160,7 @@ nice_turn_socket_new (NiceAgent *agent, NiceAddress *addr,
...
@@ -160,6 +160,7 @@ nice_turn_socket_new (NiceAgent *agent, NiceAddress *addr,
}
}
priv
->
server_addr
=
*
server_addr
;
priv
->
server_addr
=
*
server_addr
;
priv
->
compatibility
=
compatibility
;
priv
->
compatibility
=
compatibility
;
priv
->
send_requests
=
g_queue_new
();
sock
->
addr
=
*
addr
;
sock
->
addr
=
*
addr
;
sock
->
fileno
=
base_socket
->
fileno
;
sock
->
fileno
=
base_socket
->
fileno
;
sock
->
send
=
socket_send
;
sock
->
send
=
socket_send
;
...
@@ -176,6 +177,7 @@ socket_close (NiceSocket *sock)
...
@@ -176,6 +177,7 @@ socket_close (NiceSocket *sock)
{
{
TurnPriv
*
priv
=
(
TurnPriv
*
)
sock
->
priv
;
TurnPriv
*
priv
=
(
TurnPriv
*
)
sock
->
priv
;
GList
*
i
=
NULL
;
GList
*
i
=
NULL
;
for
(
i
=
priv
->
channels
;
i
;
i
=
i
->
next
)
{
for
(
i
=
priv
->
channels
;
i
;
i
=
i
->
next
)
{
ChannelBinding
*
b
=
i
->
data
;
ChannelBinding
*
b
=
i
->
data
;
g_free
(
b
);
g_free
(
b
);
...
@@ -194,13 +196,13 @@ socket_close (NiceSocket *sock)
...
@@ -194,13 +196,13 @@ socket_close (NiceSocket *sock)
priv
->
tick_source
=
NULL
;
priv
->
tick_source
=
NULL
;
}
}
for
(
i
=
priv
->
send_requests
;
i
;
i
=
i
->
next
)
{
for
(
i
=
g_queue_peek_head_link
(
priv
->
send_requests
)
;
i
;
i
=
i
->
next
)
{
SendRequest
*
r
=
i
->
data
;
SendRequest
*
r
=
i
->
data
;
g_source_destroy
(
r
->
source
);
g_source_destroy
(
r
->
source
);
g_source_unref
(
r
->
source
);
g_source_unref
(
r
->
source
);
g_slice_free
(
SendRequest
,
r
);
g_slice_free
(
SendRequest
,
r
);
}
}
g_
list
_free
(
priv
->
send_requests
);
g_
queue
_free
(
priv
->
send_requests
);
g_free
(
priv
->
current_binding
);
g_free
(
priv
->
current_binding
);
...
@@ -313,7 +315,7 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
...
@@ -313,7 +315,7 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
stun_message_id
(
&
msg
,
req
->
id
);
stun_message_id
(
&
msg
,
req
->
id
);
req
->
source
=
agent_timeout_add_with_context
(
priv
->
nice
,
STUN_END_TIMEOUT
,
req
->
source
=
agent_timeout_add_with_context
(
priv
->
nice
,
STUN_END_TIMEOUT
,
priv_forget_send_request
,
req
);
priv_forget_send_request
,
req
);
priv
->
send_requests
=
g_list_append
(
priv
->
send_requests
,
req
);
g_queue_push_tail
(
priv
->
send_requests
,
req
);
g_atomic_int_inc
(
&
req
->
ref
);
g_atomic_int_inc
(
&
req
->
ref
);
}
}
}
}
...
@@ -347,8 +349,8 @@ priv_forget_send_request (gpointer pointer)
...
@@ -347,8 +349,8 @@ priv_forget_send_request (gpointer pointer)
g_source_destroy
(
req
->
source
);
g_source_destroy
(
req
->
source
);
g_source_unref
(
req
->
source
);
g_source_unref
(
req
->
source
);
if
(
g_
list
_index
(
req
->
priv
->
send_requests
,
req
)
!=
-
1
)
{
if
(
g_
queue
_index
(
req
->
priv
->
send_requests
,
req
)
!=
-
1
)
{
req
->
priv
->
send_requests
=
g_list
_remove
(
req
->
priv
->
send_requests
,
req
);
g_queue
_remove
(
req
->
priv
->
send_requests
,
req
);
(
void
)
g_atomic_int_dec_and_test
(
&
req
->
ref
);
(
void
)
g_atomic_int_dec_and_test
(
&
req
->
ref
);
}
}
...
@@ -392,7 +394,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
...
@@ -392,7 +394,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
if
(
stun_message_get_method
(
&
msg
)
==
STUN_SEND
)
{
if
(
stun_message_get_method
(
&
msg
)
==
STUN_SEND
)
{
if
(
stun_message_get_class
(
&
msg
)
==
STUN_RESPONSE
)
{
if
(
stun_message_get_class
(
&
msg
)
==
STUN_RESPONSE
)
{
SendRequest
*
req
=
NULL
;
SendRequest
*
req
=
NULL
;
GList
*
i
=
priv
->
send_requests
;
GList
*
i
=
g_queue_peek_head_link
(
priv
->
send_requests
)
;
StunTransactionId
msg_id
;
StunTransactionId
msg_id
;
stun_message_id
(
&
msg
,
msg_id
);
stun_message_id
(
&
msg
,
msg_id
);
...
@@ -409,7 +411,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
...
@@ -409,7 +411,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
g_source_destroy
(
req
->
source
);
g_source_destroy
(
req
->
source
);
g_source_unref
(
req
->
source
);
g_source_unref
(
req
->
source
);
priv
->
send_requests
=
g_list
_remove
(
priv
->
send_requests
,
req
);
g_queue
_remove
(
priv
->
send_requests
,
req
);
if
(
g_atomic_int_dec_and_test
(
&
req
->
ref
))
if
(
g_atomic_int_dec_and_test
(
&
req
->
ref
))
g_slice_free
(
SendRequest
,
req
);
g_slice_free
(
SendRequest
,
req
);
...
...
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