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
766bdaeb
Commit
766bdaeb
authored
Apr 16, 2014
by
Youness Alaoui
Committed by
Olivier Crête
May 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send reliable-transport-writable on reliable ice-tcp and drop bogus 'ice-tcp unsupported'
parent
31fb8f44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
81 deletions
+72
-81
agent/agent.c
agent/agent.c
+72
-81
No files found.
agent/agent.c
View file @
766bdaeb
...
@@ -1686,20 +1686,16 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id,
...
@@ -1686,20 +1686,16 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id,
nice_udp_turn_socket_set_peer
(
lcandidate
->
sockptr
,
&
rcandidate
->
addr
);
nice_udp_turn_socket_set_peer
(
lcandidate
->
sockptr
,
&
rcandidate
->
addr
);
}
}
if
(
agent
->
reliable
)
{
if
(
agent
->
reliable
&&
!
nice_socket_is_reliable
(
lcandidate
->
sockptr
))
{
if
(
!
nice_socket_is_reliable
(
lcandidate
->
sockptr
))
{
if
(
!
component
->
tcp
)
if
(
!
component
->
tcp
)
pseudo_tcp_socket_create
(
agent
,
stream
,
component
);
pseudo_tcp_socket_create
(
agent
,
stream
,
component
);
process_queued_tcp_packets
(
agent
,
stream
,
component
);
process_queued_tcp_packets
(
agent
,
stream
,
component
);
pseudo_tcp_socket_connect
(
component
->
tcp
);
pseudo_tcp_socket_connect
(
component
->
tcp
);
pseudo_tcp_socket_notify_mtu
(
component
->
tcp
,
MAX_TCP_MTU
);
pseudo_tcp_socket_notify_mtu
(
component
->
tcp
,
MAX_TCP_MTU
);
adjust_tcp_clock
(
agent
,
stream
,
component
);
adjust_tcp_clock
(
agent
,
stream
,
component
);
}
else
{
nice_debug
(
"ICE-TCP not yet supported"
);
return
;
}
}
}
if
(
nice_debug_is_enabled
())
{
if
(
nice_debug_is_enabled
())
{
gchar
ip
[
100
];
gchar
ip
[
100
];
guint
port
;
guint
port
;
...
@@ -1743,6 +1739,11 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id,
...
@@ -1743,6 +1739,11 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id,
agent_queue_signal
(
agent
,
signals
[
SIGNAL_NEW_SELECTED_PAIR
],
agent_queue_signal
(
agent
,
signals
[
SIGNAL_NEW_SELECTED_PAIR
],
stream_id
,
component_id
,
lcandidate
->
foundation
,
rcandidate
->
foundation
);
stream_id
,
component_id
,
lcandidate
->
foundation
,
rcandidate
->
foundation
);
if
(
agent
->
reliable
&&
nice_socket_is_reliable
(
lcandidate
->
sockptr
))
{
agent_queue_signal
(
agent
,
signals
[
SIGNAL_RELIABLE_TRANSPORT_WRITABLE
],
stream_id
,
component_id
);
}
}
}
void
agent_signal_new_candidate
(
NiceAgent
*
agent
,
NiceCandidate
*
candidate
)
void
agent_signal_new_candidate
(
NiceAgent
*
agent
,
NiceCandidate
*
candidate
)
...
@@ -3120,12 +3121,6 @@ agent_recv_message_unlocked (
...
@@ -3120,12 +3121,6 @@ agent_recv_message_unlocked (
}
else
if
(
!
nice_socket_is_reliable
(
nicesock
))
{
}
else
if
(
!
nice_socket_is_reliable
(
nicesock
))
{
nice_debug
(
"Received data on a pseudo tcp FAILED component. Ignoring."
);
nice_debug
(
"Received data on a pseudo tcp FAILED component. Ignoring."
);
retval
=
RECV_OOB
;
goto
done
;
}
else
{
/* Received data on a reliable connection which has no TCP component. */
nice_debug
(
"Ice TCP unsupported
\n
"
);
retval
=
RECV_OOB
;
retval
=
RECV_OOB
;
goto
done
;
goto
done
;
}
}
...
@@ -4203,73 +4198,69 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data)
...
@@ -4203,73 +4198,69 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data)
* need to take the agent lock to change the Component’s io_callback. */
* need to take the agent lock to change the Component’s io_callback. */
g_assert
(
!
has_io_callback
||
component
->
recv_messages
==
NULL
);
g_assert
(
!
has_io_callback
||
component
->
recv_messages
==
NULL
);
if
(
agent
->
reliable
)
{
if
(
agent
->
reliable
&&
!
nice_socket_is_reliable
(
socket_source
->
socket
)
)
{
#define TCP_HEADER_SIZE 24
/* bytes */
#define TCP_HEADER_SIZE 24
/* bytes */
if
(
!
nice_socket_is_reliable
(
socket_source
->
socket
))
{
guint8
local_header_buf
[
TCP_HEADER_SIZE
];
guint8
local_header_buf
[
TCP_HEADER_SIZE
];
/* FIXME: Currently, the critical path for reliable packet delivery has two
/* FIXME: Currently, the critical path for reliable packet delivery has two
* memcpy()s: one into the pseudo-TCP receive buffer, and one out of it.
* memcpy()s: one into the pseudo-TCP receive buffer, and one out of it.
* This could moderately easily be reduced to one memcpy() in the common
* This could moderately easily be reduced to one memcpy() in the common
* case of in-order packet delivery, by replacing local_body_buf with a
* case of in-order packet delivery, by replacing local_body_buf with a
* pointer into the pseudo-TCP receive buffer. If it turns out the packet
* pointer into the pseudo-TCP receive buffer. If it turns out the packet
* is out-of-order (which we can only know after parsing its header), the
* is out-of-order (which we can only know after parsing its header), the
* data will need to be moved in the buffer. If the packet *is* in order,
* data will need to be moved in the buffer. If the packet *is* in order,
* however, the only memcpy() then needed is from the pseudo-TCP receive
* however, the only memcpy() then needed is from the pseudo-TCP receive
* buffer to the client’s message buffers.
* buffer to the client’s message buffers.
*
*
* In fact, in the case of a reliable agent with I/O callbacks, zero
* In fact, in the case of a reliable agent with I/O callbacks, zero
* memcpy()s can be achieved (for in-order packet delivery) by emittin the
* memcpy()s can be achieved (for in-order packet delivery) by emittin the
* I/O callback directly from the pseudo-TCP receive buffer. */
* I/O callback directly from the pseudo-TCP receive buffer. */
guint8
local_body_buf
[
MAX_BUFFER_SIZE
];
guint8
local_body_buf
[
MAX_BUFFER_SIZE
];
GInputVector
local_bufs
[]
=
{
GInputVector
local_bufs
[]
=
{
{
local_header_buf
,
sizeof
(
local_header_buf
)
},
{
local_header_buf
,
sizeof
(
local_header_buf
)
},
{
local_body_buf
,
sizeof
(
local_body_buf
)
},
{
local_body_buf
,
sizeof
(
local_body_buf
)
},
};
};
NiceInputMessage
local_message
=
{
NiceInputMessage
local_message
=
{
local_bufs
,
G_N_ELEMENTS
(
local_bufs
),
NULL
,
0
local_bufs
,
G_N_ELEMENTS
(
local_bufs
),
NULL
,
0
};
};
RecvStatus
retval
=
0
;
RecvStatus
retval
=
0
;
if
(
component
->
tcp
==
NULL
)
{
if
(
component
->
tcp
==
NULL
)
{
nice_debug
(
"Agent %p: not handling incoming packet for s%d:%d "
nice_debug
(
"Agent %p: not handling incoming packet for s%d:%d "
"because pseudo-TCP socket does not exist in reliable mode."
,
agent
,
"because pseudo-TCP socket does not exist in reliable mode."
,
agent
,
stream
->
id
,
component
->
id
);
stream
->
id
,
component
->
id
);
remove_source
=
TRUE
;
remove_source
=
TRUE
;
goto
done
;
goto
done
;
}
}
while
(
has_io_callback
||
while
(
has_io_callback
||
(
component
->
recv_messages
!=
NULL
&&
(
component
->
recv_messages
!=
NULL
&&
!
nice_input_message_iter_is_at_end
(
&
component
->
recv_messages_iter
,
!
nice_input_message_iter_is_at_end
(
&
component
->
recv_messages_iter
,
component
->
recv_messages
,
component
->
n_recv_messages
)))
{
component
->
recv_messages
,
component
->
n_recv_messages
)))
{
/* Receive a single message. This will receive it into the given
/* Receive a single message. This will receive it into the given
* @local_bufs then, for pseudo-TCP, emit I/O callbacks or copy it into
* @local_bufs then, for pseudo-TCP, emit I/O callbacks or copy it into
* component->recv_messages in pseudo_tcp_socket_readable(). STUN packets
* component->recv_messages in pseudo_tcp_socket_readable(). STUN packets
* will be parsed in-place. */
* will be parsed in-place. */
retval
=
agent_recv_message_unlocked
(
agent
,
stream
,
component
,
retval
=
agent_recv_message_unlocked
(
agent
,
stream
,
component
,
socket_source
->
socket
,
&
local_message
);
socket_source
->
socket
,
&
local_message
);
nice_debug
(
"%s: %p: received %d valid messages with %"
G_GSSIZE_FORMAT
nice_debug
(
"%s: %p: received %d valid messages with %"
G_GSSIZE_FORMAT
" bytes"
,
G_STRFUNC
,
agent
,
retval
,
local_message
.
length
);
" bytes"
,
G_STRFUNC
,
agent
,
retval
,
local_message
.
length
);
/* Don’t expect any valid messages to escape pseudo_tcp_socket_readable()
* when in reliable mode. */
g_assert_cmpint
(
retval
,
!=
,
RECV_SUCCESS
);
if
(
retval
==
RECV_WOULD_BLOCK
)
{
/* EWOULDBLOCK. */
break
;
}
else
if
(
retval
==
RECV_ERROR
)
{
/* Other error. */
nice_debug
(
"%s: error receiving message"
,
G_STRFUNC
);
remove_source
=
TRUE
;
break
;
}
has_io_callback
=
component_has_io_callback
(
component
);
/* Don’t expect any valid messages to escape pseudo_tcp_socket_readable()
* when in reliable mode. */
g_assert_cmpint
(
retval
,
!=
,
RECV_SUCCESS
);
if
(
retval
==
RECV_WOULD_BLOCK
)
{
/* EWOULDBLOCK. */
break
;
}
else
if
(
retval
==
RECV_ERROR
)
{
/* Other error. */
nice_debug
(
"%s: error receiving message"
,
G_STRFUNC
);
remove_source
=
TRUE
;
break
;
}
}
}
else
{
nice_debug
(
"unsupported ice-tcp"
);
has_io_callback
=
component_has_io_callback
(
component
);
}
}
}
else
if
(
has_io_callback
)
{
}
else
if
(
has_io_callback
)
{
while
(
has_io_callback
)
{
while
(
has_io_callback
)
{
...
...
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