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
57393333
Commit
57393333
authored
Mar 31, 2014
by
Youness Alaoui
Committed by
Olivier Crête
May 15, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some refactoring to allow for ice-tcp (non pseudotcp reliable)
parent
c0ca6c65
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
69 deletions
+80
-69
agent/agent-priv.h
agent/agent-priv.h
+2
-2
agent/agent.c
agent/agent.c
+60
-45
agent/component.c
agent/component.c
+8
-0
agent/conncheck.c
agent/conncheck.c
+10
-22
No files found.
agent/agent-priv.h
View file @
57393333
...
...
@@ -184,8 +184,8 @@ void agent_signal_new_selected_pair (
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
,
const
gchar
*
local_foundation
,
const
gchar
*
remote_foundation
);
NiceCandidate
*
lcandidate
,
NiceCandidate
*
rcandidate
);
void
agent_signal_component_state_change
(
NiceAgent
*
agent
,
...
...
agent/agent.c
View file @
57393333
...
...
@@ -1610,7 +1610,8 @@ process_queued_tcp_packets (NiceAgent *agent, Stream *stream,
}
}
void
agent_signal_new_selected_pair
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
,
const
gchar
*
local_foundation
,
const
gchar
*
remote_foundation
)
void
agent_signal_new_selected_pair
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
,
NiceCandidate
*
lcandidate
,
NiceCandidate
*
rcandidate
)
{
Component
*
component
;
Stream
*
stream
;
...
...
@@ -1620,23 +1621,29 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id, guint co
return
;
if
(
component
->
selected_pair
.
local
->
type
==
NICE_CANDIDATE_TYPE_RELAYED
)
{
nice_turn_socket_set_peer
(
component
->
selected_pair
.
local
->
sockptr
,
&
component
->
selected_pair
.
remote
->
addr
);
nice_turn_socket_set_peer
(
lcandidate
->
sockptr
,
&
rcandidate
->
addr
);
}
if
(
agent
->
reliable
)
{
if
(
lcandidate
->
transport
==
NICE_CANDIDATE_TRANSPORT_UDP
)
{
if
(
component
->
tcp
)
{
process_queued_tcp_packets
(
agent
,
stream
,
component
);
pseudo_tcp_socket_connect
(
component
->
tcp
);
pseudo_tcp_socket_notify_mtu
(
component
->
tcp
,
MAX_TCP_MTU
);
adjust_tcp_clock
(
agent
,
stream
,
component
);
}
else
if
(
agent
->
reliable
)
{
nice_debug
(
"New selected pair received when pseudo tcp socket in error"
);
}
else
{
nice_debug
(
"New reliable UDP pair selected but pseudo tcp socket in error"
);
return
;
}
}
else
{
nice_debug
(
"ICE-TCP not yet supported"
);
return
;
}
}
agent_queue_signal
(
agent
,
signals
[
SIGNAL_NEW_SELECTED_PAIR
],
stream_id
,
component_id
,
l
ocal_foundation
,
remote_
foundation
);
stream_id
,
component_id
,
l
candidate
->
foundation
,
rcandidate
->
foundation
);
}
void
agent_signal_new_candidate
(
NiceAgent
*
agent
,
NiceCandidate
*
candidate
)
...
...
@@ -3505,7 +3512,18 @@ nice_agent_send_messages_nonblocking_internal (
/* FIXME: Cancellation isn’t yet supported, but it doesn’t matter because
* we only deal with non-blocking writes. */
if
(
component
->
selected_pair
.
local
!=
NULL
)
{
if
(
nice_debug_is_enabled
())
{
gchar
tmpbuf
[
INET6_ADDRSTRLEN
];
nice_address_to_string
(
&
component
->
selected_pair
.
remote
->
addr
,
tmpbuf
);
nice_debug
(
"Agent %p : s%d:%d: sending %u messages to "
"[%s]:%d"
,
agent
,
stream_id
,
component_id
,
n_messages
,
tmpbuf
,
nice_address_get_port
(
&
component
->
selected_pair
.
remote
->
addr
));
}
if
(
agent
->
reliable
)
{
if
(
component
->
selected_pair
.
local
->
transport
==
NICE_CANDIDATE_TRANSPORT_UDP
)
{
if
(
component
->
tcp
!=
NULL
)
{
/* Send on the pseudo-TCP socket. */
n_sent
=
pseudo_tcp_socket_send_messages
(
component
->
tcp
,
messages
,
...
...
@@ -3519,22 +3537,18 @@ nice_agent_send_messages_nonblocking_internal (
/* Signal errors */
priv_pseudo_tcp_error
(
agent
,
stream
,
component
);
}
}
else
if
(
agent
->
reliable
)
{
}
else
{
g_set_error
(
&
child_error
,
G_IO_ERROR
,
G_IO_ERROR_FAILED
,
"Error writing data to failed pseudo-TCP socket."
);
}
else
if
(
component
->
selected_pair
.
local
!=
NULL
)
{
}
}
else
{
g_set_error
(
&
child_error
,
G_IO_ERROR
,
G_IO_ERROR_FAILED
,
"ICE-TCP not yet supported."
);
}
}
else
{
NiceSocket
*
sock
;
NiceAddress
*
addr
;
if
(
nice_debug_is_enabled
())
{
gchar
tmpbuf
[
INET6_ADDRSTRLEN
];
nice_address_to_string
(
&
component
->
selected_pair
.
remote
->
addr
,
tmpbuf
);
nice_debug
(
"Agent %p : s%d:%d: sending %u messages to "
"[%s]:%d"
,
agent
,
stream_id
,
component_id
,
n_messages
,
tmpbuf
,
nice_address_get_port
(
&
component
->
selected_pair
.
remote
->
addr
));
}
sock
=
component
->
selected_pair
.
local
->
sockptr
;
addr
=
&
component
->
selected_pair
.
remote
->
addr
;
...
...
@@ -3547,6 +3561,7 @@ nice_agent_send_messages_nonblocking_internal (
g_assert
(
n_messages
==
1
);
n_sent
=
output_message_get_size
(
messages
);
}
}
}
else
{
/* Socket isn’t properly open yet. */
n_sent
=
0
;
/* EWOULDBLOCK */
...
...
@@ -4061,7 +4076,8 @@ nice_agent_set_selected_pair (
/* step: set the selected pair */
component_update_selected_pair
(
component
,
&
pair
);
agent_signal_new_selected_pair
(
agent
,
stream_id
,
component_id
,
lfoundation
,
rfoundation
);
agent_signal_new_selected_pair
(
agent
,
stream_id
,
component_id
,
pair
.
local
,
pair
.
remote
);
ret
=
TRUE
;
...
...
@@ -4189,8 +4205,7 @@ nice_agent_set_selected_remote_candidate (
agent_signal_component_state_change
(
agent
,
stream_id
,
component_id
,
NICE_COMPONENT_STATE_READY
);
agent_signal_new_selected_pair
(
agent
,
stream_id
,
component_id
,
lcandidate
->
foundation
,
candidate
->
foundation
);
lcandidate
,
candidate
);
ret
=
TRUE
;
...
...
agent/component.c
View file @
57393333
...
...
@@ -375,6 +375,14 @@ void component_update_selected_pair (Component *component, const CandidatePair *
component
->
selected_pair
.
keepalive
.
tick_source
=
NULL
;
}
if
(
component
->
selected_pair
.
local
&&
component
->
selected_pair
.
local
==
component
->
turn_candidate
)
{
refresh_prune_candidate
(
component
->
agent
,
component
->
turn_candidate
);
component_detach_socket
(
component
,
component
->
turn_candidate
->
sockptr
);
nice_candidate_free
(
component
->
turn_candidate
);
component
->
turn_candidate
=
NULL
;
}
memset
(
&
component
->
selected_pair
,
0
,
sizeof
(
CandidatePair
));
component
->
selected_pair
.
local
=
pair
->
local
;
...
...
agent/conncheck.c
View file @
57393333
...
...
@@ -1115,35 +1115,23 @@ static GSList *priv_limit_conn_check_list_size (GSList *conncheck_list, guint up
*/
static
gboolean
priv_update_selected_pair
(
NiceAgent
*
agent
,
Component
*
component
,
CandidateCheckPair
*
pair
)
{
CandidatePair
cpair
;
g_assert
(
component
);
g_assert
(
pair
);
if
(
pair
->
priority
>
component
->
selected_pair
.
priority
)
{
if
(
pair
->
priority
>
component
->
selected_pair
.
priority
&&
component_find_pair
(
component
,
agent
,
pair
->
local
->
foundation
,
pair
->
remote
->
foundation
,
&
cpair
))
{
nice_debug
(
"Agent %p : changing SELECTED PAIR for component %u: %s:%s "
"(prio:%"
G_GUINT64_FORMAT
")."
,
agent
,
component
->
id
,
pair
->
local
->
foundation
,
pair
->
remote
->
foundation
,
pair
->
priority
);
if
(
component
->
selected_pair
.
keepalive
.
tick_source
!=
NULL
)
{
g_source_destroy
(
component
->
selected_pair
.
keepalive
.
tick_source
);
g_source_unref
(
component
->
selected_pair
.
keepalive
.
tick_source
);
component
->
selected_pair
.
keepalive
.
tick_source
=
NULL
;
}
if
(
component
->
selected_pair
.
local
&&
component
->
selected_pair
.
local
==
component
->
turn_candidate
)
{
refresh_prune_candidate
(
agent
,
component
->
turn_candidate
);
component_detach_socket
(
component
,
component
->
turn_candidate
->
sockptr
);
nice_candidate_free
(
component
->
turn_candidate
);
component
->
turn_candidate
=
NULL
;
}
"(prio:%"
G_GUINT64_FORMAT
")."
,
agent
,
component
->
id
,
pair
->
local
->
foundation
,
pair
->
remote
->
foundation
,
pair
->
priority
);
memset
(
&
component
->
selected_pair
,
0
,
sizeof
(
CandidatePair
));
component
->
selected_pair
.
local
=
pair
->
local
;
component
->
selected_pair
.
remote
=
pair
->
remote
;
component
->
selected_pair
.
priority
=
pair
->
priority
;
component_update_selected_pair
(
component
,
&
cpair
);
priv_conn_keepalive_tick_unlocked
(
agent
);
agent_signal_new_selected_pair
(
agent
,
pair
->
stream_id
,
component
->
id
,
pair
->
local
->
foundation
,
pair
->
remote
->
foundation
);
agent_signal_new_selected_pair
(
agent
,
pair
->
stream_id
,
component
->
id
,
pair
->
local
,
pair
->
remote
);
}
...
...
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