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
4e9b3e12
Commit
4e9b3e12
authored
Mar 31, 2014
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename variables that shadow global definitions
parent
972eb35f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
77 additions
and
77 deletions
+77
-77
agent/agent.c
agent/agent.c
+35
-35
agent/component.c
agent/component.c
+6
-6
agent/component.h
agent/component.h
+2
-2
agent/conncheck.c
agent/conncheck.c
+18
-18
agent/inputstream.c
agent/inputstream.c
+2
-2
agent/outputstream.c
agent/outputstream.c
+2
-2
agent/pseudotcp.c
agent/pseudotcp.c
+4
-4
socket/tcp-turn.c
socket/tcp-turn.c
+2
-2
tests/test-send-recv.c
tests/test-send-recv.c
+6
-6
No files found.
agent/agent.c
View file @
4e9b3e12
...
...
@@ -1391,7 +1391,7 @@ pseudo_tcp_socket_closed (PseudoTcpSocket *sock, guint32 err,
static
PseudoTcpWriteResult
pseudo_tcp_socket_write_packet
(
PseudoTcpSocket
*
socket
,
pseudo_tcp_socket_write_packet
(
PseudoTcpSocket
*
p
socket
,
const
gchar
*
buffer
,
guint32
len
,
gpointer
user_data
)
{
Component
*
component
=
user_data
;
...
...
@@ -1726,7 +1726,7 @@ agent_candidate_pair_priority (NiceAgent *agent, NiceCandidate *local, NiceCandi
static
void
priv_add_new_candidate_discovery_stun
(
NiceAgent
*
agent
,
NiceSocket
*
socket
,
NiceAddress
server
,
NiceSocket
*
nicesock
,
NiceAddress
server
,
Stream
*
stream
,
guint
component_id
)
{
CandidateDiscovery
*
cdisco
;
...
...
@@ -1737,7 +1737,7 @@ priv_add_new_candidate_discovery_stun (NiceAgent *agent,
cdisco
=
g_slice_new0
(
CandidateDiscovery
);
cdisco
->
type
=
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
;
cdisco
->
nicesock
=
socket
;
cdisco
->
nicesock
=
nicesock
;
cdisco
->
server
=
server
;
cdisco
->
stream
=
stream
;
cdisco
->
component
=
stream_find_component_by_id
(
stream
,
component_id
);
...
...
@@ -1757,7 +1757,7 @@ priv_add_new_candidate_discovery_stun (NiceAgent *agent,
static
void
priv_add_new_candidate_discovery_turn
(
NiceAgent
*
agent
,
NiceSocket
*
socket
,
TurnServer
*
turn
,
NiceSocket
*
nicesock
,
TurnServer
*
turn
,
Stream
*
stream
,
guint
component_id
)
{
CandidateDiscovery
*
cdisco
;
...
...
@@ -1771,7 +1771,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
if
(
turn
->
type
==
NICE_RELAY_TYPE_TURN_UDP
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
NiceAddress
addr
=
socket
->
addr
;
NiceAddress
addr
=
nicesock
->
addr
;
NiceSocket
*
new_socket
;
nice_address_set_port
(
&
addr
,
0
);
...
...
@@ -1779,51 +1779,51 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
if
(
new_socket
)
{
_priv_set_socket_tos
(
agent
,
new_socket
,
stream
->
tos
);
component_attach_socket
(
component
,
new_socket
);
socket
=
new_socket
;
nicesock
=
new_socket
;
}
}
cdisco
->
nicesock
=
socket
;
cdisco
->
nicesock
=
nicesock
;
}
else
{
NiceAddress
proxy_server
;
socket
=
NULL
;
nicesock
=
NULL
;
if
(
agent
->
proxy_type
!=
NICE_PROXY_TYPE_NONE
&&
agent
->
proxy_ip
!=
NULL
&&
nice_address_set_from_string
(
&
proxy_server
,
agent
->
proxy_ip
))
{
nice_address_set_port
(
&
proxy_server
,
agent
->
proxy_port
);
socket
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
proxy_server
);
nicesock
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
proxy_server
);
if
(
socket
)
{
_priv_set_socket_tos
(
agent
,
socket
,
stream
->
tos
);
if
(
nicesock
)
{
_priv_set_socket_tos
(
agent
,
nicesock
,
stream
->
tos
);
if
(
agent
->
proxy_type
==
NICE_PROXY_TYPE_SOCKS5
)
{
socket
=
nice_socks5_socket_new
(
socket
,
&
turn
->
server
,
nicesock
=
nice_socks5_socket_new
(
nicesock
,
&
turn
->
server
,
agent
->
proxy_username
,
agent
->
proxy_password
);
}
else
if
(
agent
->
proxy_type
==
NICE_PROXY_TYPE_HTTP
){
socket
=
nice_http_socket_new
(
socket
,
&
turn
->
server
,
nicesock
=
nice_http_socket_new
(
nicesock
,
&
turn
->
server
,
agent
->
proxy_username
,
agent
->
proxy_password
);
}
else
{
nice_socket_free
(
socket
);
socket
=
NULL
;
nice_socket_free
(
nicesock
);
nicesock
=
NULL
;
}
}
}
if
(
socket
==
NULL
)
{
socket
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
turn
->
server
);
if
(
nicesock
==
NULL
)
{
nicesock
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
turn
->
server
);
if
(
socket
)
_priv_set_socket_tos
(
agent
,
socket
,
stream
->
tos
);
if
(
nicesock
)
_priv_set_socket_tos
(
agent
,
nicesock
,
stream
->
tos
);
}
/* The TURN server may be invalid or not listening */
if
(
socket
==
NULL
)
if
(
nicesock
==
NULL
)
return
;
if
(
turn
->
type
==
NICE_RELAY_TYPE_TURN_TLS
&&
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
socket
=
nice_pseudossl_socket_new
(
socket
);
nicesock
=
nice_pseudossl_socket_new
(
nicesock
);
}
cdisco
->
nicesock
=
nice_tcp_turn_socket_new
(
socket
,
cdisco
->
nicesock
=
nice_tcp_turn_socket_new
(
nicesock
,
agent_to_turn_socket_compatibility
(
agent
));
component_attach_socket
(
component
,
cdisco
->
nicesock
);
...
...
@@ -2194,9 +2194,9 @@ nice_agent_gather_candidates (
}
else
{
for
(
i
=
agent
->
local_addresses
;
i
;
i
=
i
->
next
)
{
NiceAddress
*
addr
=
i
->
data
;
NiceAddress
*
dup
=
nice_address_dup
(
addr
);
NiceAddress
*
dup
addr
=
nice_address_dup
(
addr
);
local_addresses
=
g_slist_append
(
local_addresses
,
dup
);
local_addresses
=
g_slist_append
(
local_addresses
,
dup
addr
);
}
}
...
...
@@ -2450,13 +2450,13 @@ nice_agent_set_port_range (NiceAgent *agent, guint stream_id, guint component_id
NICEAPI_EXPORT
gboolean
nice_agent_add_local_address
(
NiceAgent
*
agent
,
NiceAddress
*
addr
)
{
NiceAddress
*
dup
;
NiceAddress
*
dup
addr
;
agent_lock
();
dup
=
nice_address_dup
(
addr
);
nice_address_set_port
(
dup
,
0
);
agent
->
local_addresses
=
g_slist_append
(
agent
->
local_addresses
,
dup
);
dup
addr
=
nice_address_dup
(
addr
);
nice_address_set_port
(
dup
addr
,
0
);
agent
->
local_addresses
=
g_slist_append
(
agent
->
local_addresses
,
dup
addr
);
agent_unlock_and_emit
(
agent
);
return
TRUE
;
...
...
@@ -2736,7 +2736,7 @@ agent_recv_message_unlocked (
NiceAgent
*
agent
,
Stream
*
stream
,
Component
*
component
,
NiceSocket
*
socket
,
NiceSocket
*
nicesock
,
NiceInputMessage
*
message
)
{
NiceAddress
from
;
...
...
@@ -2748,10 +2748,10 @@ agent_recv_message_unlocked (
message
->
from
=
&
from
;
}
retval
=
nice_socket_recv_messages
(
socket
,
message
,
1
);
retval
=
nice_socket_recv_messages
(
nicesock
,
message
,
1
);
nice_debug
(
"%s: Received %d valid messages of length %"
G_GSIZE_FORMAT
" from base socket %p."
,
G_STRFUNC
,
retval
,
message
->
length
,
socket
);
" from base socket %p."
,
G_STRFUNC
,
retval
,
message
->
length
,
nicesock
);
if
(
retval
==
0
)
{
retval
=
RECV_WOULD_BLOCK
;
/* EWOULDBLOCK */
...
...
@@ -2773,7 +2773,7 @@ agent_recv_message_unlocked (
gchar
tmpbuf
[
INET6_ADDRSTRLEN
];
nice_address_to_string
(
message
->
from
,
tmpbuf
);
nice_debug
(
"Agent %p : Packet received on local socket %d from [%s]:%u (%"
G_GSSIZE_FORMAT
" octets)."
,
agent
,
g_socket_get_fd
(
socket
->
fileno
),
tmpbuf
,
g_socket_get_fd
(
nicesock
->
fileno
),
tmpbuf
,
nice_address_get_port
(
message
->
from
),
message
->
length
);
}
...
...
@@ -2793,7 +2793,7 @@ agent_recv_message_unlocked (
if
(
cand
->
type
==
NICE_CANDIDATE_TYPE_RELAYED
&&
cand
->
stream_id
==
stream
->
id
&&
cand
->
component_id
==
component
->
id
)
{
retval
=
nice_turn_socket_parse_recv_message
(
cand
->
sockptr
,
&
socket
,
retval
=
nice_turn_socket_parse_recv_message
(
cand
->
sockptr
,
&
nicesock
,
message
);
break
;
}
...
...
@@ -2822,7 +2822,7 @@ agent_recv_message_unlocked (
if
(
stun_message_validate_buffer_length
(
big_buf
,
big_buf_len
,
(
agent
->
compatibility
!=
NICE_COMPATIBILITY_OC2007
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_OC2007R2
))
==
(
gint
)
big_buf_len
&&
conn_check_handle_inbound_stun
(
agent
,
stream
,
component
,
socket
,
conn_check_handle_inbound_stun
(
agent
,
stream
,
component
,
nicesock
,
message
->
from
,
(
gchar
*
)
big_buf
,
big_buf_len
))
{
/* Handled STUN message. */
nice_debug
(
"%s: Valid STUN packet received."
,
G_STRFUNC
);
...
...
@@ -3792,7 +3792,7 @@ nice_agent_dispose (GObject *object)
}
gboolean
component_io_cb
(
GSocket
*
socket
,
GIOCondition
condition
,
gpointer
user_data
)
component_io_cb
(
GSocket
*
g
socket
,
GIOCondition
condition
,
gpointer
user_data
)
{
SocketSource
*
socket_source
=
user_data
;
Component
*
component
;
...
...
agent/component.c
View file @
4e9b3e12
...
...
@@ -432,13 +432,13 @@ _find_socket_source (gconstpointer a, gconstpointer b)
/* This takes ownership of the socket.
* It creates and attaches a source to the component’s context. */
void
component_attach_socket
(
Component
*
component
,
NiceSocket
*
socket
)
component_attach_socket
(
Component
*
component
,
NiceSocket
*
nicesock
)
{
GSList
*
l
;
SocketSource
*
socket_source
;
g_assert
(
component
!=
NULL
);
g_assert
(
socket
!=
NULL
);
g_assert
(
nicesock
!=
NULL
);
g_assert
(
component
->
ctx
!=
NULL
);
...
...
@@ -455,13 +455,13 @@ component_attach_socket (Component *component, NiceSocket *socket)
* or discovery failure, which are both unrecoverable states.
*
* An empty socket_sources corresponds to age 0. */
l
=
g_slist_find_custom
(
component
->
socket_sources
,
socket
,
l
=
g_slist_find_custom
(
component
->
socket_sources
,
nicesock
,
_find_socket_source
);
if
(
l
!=
NULL
)
{
socket_source
=
l
->
data
;
}
else
{
socket_source
=
g_slice_new0
(
SocketSource
);
socket_source
->
socket
=
socket
;
socket_source
->
socket
=
nicesock
;
socket_source
->
component
=
component
;
component
->
socket_sources
=
g_slist_prepend
(
component
->
socket_sources
,
socket_source
);
...
...
@@ -502,12 +502,12 @@ component_reattach_all_sockets (Component *component)
* If the @socket doesn’t exist in this @component, do nothing.
*/
void
component_detach_socket
(
Component
*
component
,
NiceSocket
*
socket
)
component_detach_socket
(
Component
*
component
,
NiceSocket
*
nicesock
)
{
GSList
*
l
;
SocketSource
*
socket_source
;
nice_debug
(
"Detach socket %p."
,
socket
);
nice_debug
(
"Detach socket %p."
,
nicesock
);
/* Find the SocketSource for the socket. */
l
=
g_slist_find_custom
(
component
->
socket_sources
,
socket
,
...
...
agent/component.h
View file @
4e9b3e12
...
...
@@ -228,9 +228,9 @@ component_set_selected_remote_candidate (NiceAgent *agent, Component *component,
NiceCandidate
*
candidate
);
void
component_attach_socket
(
Component
*
component
,
NiceSocket
*
socket
);
component_attach_socket
(
Component
*
component
,
NiceSocket
*
n
socket
);
void
component_detach_socket
(
Component
*
component
,
NiceSocket
*
socket
);
component_detach_socket
(
Component
*
component
,
NiceSocket
*
n
socket
);
void
component_detach_all_sockets
(
Component
*
component
);
void
...
...
agent/conncheck.c
View file @
4e9b3e12
...
...
@@ -1903,7 +1903,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream,
*
* @pre (rcand == NULL || nice_address_equal(rcand->addr, toaddr) == TRUE)
*/
static
void
priv_reply_to_conn_check
(
NiceAgent
*
agent
,
Stream
*
stream
,
Component
*
component
,
NiceCandidate
*
rcand
,
const
NiceAddress
*
toaddr
,
NiceSocket
*
sock
et
,
size_t
rbuf_len
,
uint8_t
*
rbuf
,
gboolean
use_candidate
)
static
void
priv_reply_to_conn_check
(
NiceAgent
*
agent
,
Stream
*
stream
,
Component
*
component
,
NiceCandidate
*
rcand
,
const
NiceAddress
*
toaddr
,
NiceSocket
*
sock
ptr
,
size_t
rbuf_len
,
uint8_t
*
rbuf
,
gboolean
use_candidate
)
{
g_assert
(
rcand
==
NULL
||
nice_address_equal
(
&
rcand
->
addr
,
toaddr
)
==
TRUE
);
...
...
@@ -1913,17 +1913,17 @@ static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Componen
nice_debug
(
"Agent %p : STUN-CC RESP to '%s:%u', socket=%u, len=%u, cand=%p (c-id:%u), use-cand=%d."
,
agent
,
tmpbuf
,
nice_address_get_port
(
toaddr
),
g_socket_get_fd
(
sock
et
->
fileno
),
g_socket_get_fd
(
sock
ptr
->
fileno
),
(
unsigned
)
rbuf_len
,
rcand
,
component
->
id
,
(
int
)
use_candidate
);
}
nice_socket_send
(
sock
et
,
toaddr
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
nice_socket_send
(
sock
ptr
,
toaddr
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
if
(
rcand
)
{
/* note: upon successful check, make the reserve check immediately */
priv_schedule_triggered_check
(
agent
,
stream
,
component
,
sock
et
,
rcand
,
use_candidate
);
priv_schedule_triggered_check
(
agent
,
stream
,
component
,
sock
ptr
,
rcand
,
use_candidate
);
if
(
use_candidate
)
priv_mark_pair_nominated
(
agent
,
stream
,
component
,
rcand
);
...
...
@@ -1939,7 +1939,7 @@ static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Componen
* @return non-zero on error, zero on success
*/
static
int
priv_store_pending_check
(
NiceAgent
*
agent
,
Component
*
component
,
const
NiceAddress
*
from
,
NiceSocket
*
sock
et
,
uint8_t
*
username
,
const
NiceAddress
*
from
,
NiceSocket
*
sock
ptr
,
uint8_t
*
username
,
uint16_t
username_len
,
uint32_t
priority
,
gboolean
use_candidate
)
{
IncomingCheck
*
icheck
;
...
...
@@ -1955,7 +1955,7 @@ static int priv_store_pending_check (NiceAgent *agent, Component *component,
icheck
=
g_slice_new0
(
IncomingCheck
);
component
->
incoming_checks
=
g_slist_append
(
component
->
incoming_checks
,
icheck
);
icheck
->
from
=
*
from
;
icheck
->
local_socket
=
sock
et
;
icheck
->
local_socket
=
sock
ptr
;
icheck
->
priority
=
priority
;
icheck
->
use_candidate
=
use_candidate
;
icheck
->
username_len
=
username_len
;
...
...
@@ -2713,7 +2713,7 @@ static bool conncheck_stun_validater (StunAgent *agent,
* @param agent self pointer
* @param stream stream the packet is related to
* @param component component the packet is related to
* @param
socket
socket from which the packet was received
* @param
nicesock
socket from which the packet was received
* @param from address of the sender
* @param buf message contents
* @param buf message length
...
...
@@ -2723,7 +2723,7 @@ static bool conncheck_stun_validater (StunAgent *agent,
* @return XXX (what FALSE means exactly?)
*/
gboolean
conn_check_handle_inbound_stun
(
NiceAgent
*
agent
,
Stream
*
stream
,
Component
*
component
,
NiceSocket
*
socket
,
const
NiceAddress
*
from
,
Component
*
component
,
NiceSocket
*
nicesock
,
const
NiceAddress
*
from
,
gchar
*
buf
,
guint
len
)
{
union
{
...
...
@@ -2771,7 +2771,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
for
(
i
=
agent
->
discovery_list
;
i
;
i
=
i
->
next
)
{
CandidateDiscovery
*
d
=
i
->
data
;
if
(
d
->
stream
==
stream
&&
d
->
component
==
component
&&
d
->
nicesock
==
socket
)
{
d
->
nicesock
==
nicesock
)
{
valid
=
stun_agent_validate
(
&
d
->
stun_agent
,
&
req
,
(
uint8_t
*
)
buf
,
len
,
conncheck_stun_validater
,
&
validater_data
);
...
...
@@ -2789,9 +2789,9 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
for
(
i
=
agent
->
refresh_list
;
i
;
i
=
i
->
next
)
{
CandidateRefresh
*
r
=
i
->
data
;
nice_debug
(
"Comparing %p to %p, %p to %p and %p and %p to %p"
,
r
->
stream
,
stream
,
r
->
component
,
component
,
r
->
nicesock
,
r
->
relay_socket
,
socket
);
stream
,
r
->
component
,
component
,
r
->
nicesock
,
r
->
relay_socket
,
nicesock
);
if
(
r
->
stream
==
stream
&&
r
->
component
==
component
&&
(
r
->
nicesock
==
socket
||
r
->
relay_socket
==
socket
))
{
(
r
->
nicesock
==
nicesock
||
r
->
relay_socket
==
nicesock
))
{
valid
=
stun_agent_validate
(
&
r
->
stun_agent
,
&
req
,
(
uint8_t
*
)
buf
,
len
,
conncheck_stun_validater
,
&
validater_data
);
nice_debug
(
"Validating gave %d"
,
valid
);
...
...
@@ -2822,7 +2822,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
rbuf_len
=
stun_agent_build_unknown_attributes_error
(
&
agent
->
stun_agent
,
&
msg
,
rbuf
,
rbuf_len
,
&
req
);
if
(
rbuf_len
!=
0
)
nice_socket_send
(
socket
,
from
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
nice_socket_send
(
nicesock
,
from
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
}
return
TRUE
;
}
...
...
@@ -2835,7 +2835,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
rbuf_len
=
stun_agent_finish_message
(
&
agent
->
stun_agent
,
&
msg
,
NULL
,
0
);
if
(
rbuf_len
>
0
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_MSN
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_OC2007
)
nice_socket_send
(
socket
,
from
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
nice_socket_send
(
nicesock
,
from
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
}
return
TRUE
;
}
...
...
@@ -2846,7 +2846,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
rbuf_len
=
stun_agent_finish_message
(
&
agent
->
stun_agent
,
&
msg
,
NULL
,
0
);
if
(
rbuf_len
>
0
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_MSN
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_OC2007
)
nice_socket_send
(
socket
,
from
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
nice_socket_send
(
nicesock
,
from
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
}
return
TRUE
;
}
...
...
@@ -2988,7 +2988,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
nice_debug
(
"Agent %p : No matching remote candidate for incoming check ->"
"peer-reflexive candidate."
,
agent
);
remote_candidate
=
discovery_learn_remote_peer_reflexive_candidate
(
agent
,
stream
,
component
,
priority
,
from
,
socket
,
agent
,
stream
,
component
,
priority
,
from
,
nicesock
,
local_candidate
,
remote_candidate2
?
remote_candidate2
:
remote_candidate
);
if
(
remote_candidate
)
...
...
@@ -2996,7 +2996,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
}
priv_reply_to_conn_check
(
agent
,
stream
,
component
,
remote_candidate
,
from
,
socket
,
rbuf_len
,
rbuf
,
use_candidate
);
from
,
nicesock
,
rbuf_len
,
rbuf
,
use_candidate
);
if
(
component
->
remote_candidates
==
NULL
)
{
/* case: We've got a valid binding request to a local candidate
...
...
@@ -3006,7 +3006,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
* we get information about the remote candidates */
/* step: send a reply immediately but postpone other processing */
priv_store_pending_check
(
agent
,
component
,
from
,
socket
,
priv_store_pending_check
(
agent
,
component
,
from
,
nicesock
,
username
,
username_len
,
priority
,
use_candidate
);
}
}
else
{
...
...
@@ -3023,7 +3023,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
/* step: let's try to match the response to an existing check context */
if
(
trans_found
!=
TRUE
)
trans_found
=
priv_map_reply_to_conn_check_request
(
agent
,
stream
,
component
,
socket
,
from
,
local_candidate
,
remote_candidate
,
&
req
);
component
,
nicesock
,
from
,
local_candidate
,
remote_candidate
,
&
req
);
/* step: let's try to match the response to an existing discovery */
if
(
trans_found
!=
TRUE
)
...
...
agent/inputstream.c
View file @
4e9b3e12
...
...
@@ -360,9 +360,9 @@ nice_input_stream_is_readable (GPollableInputStream *stream)
/* Check whether any of the component’s FDs are pollable. */
for
(
i
=
component
->
socket_sources
;
i
!=
NULL
;
i
=
i
->
next
)
{
SocketSource
*
socket_source
=
i
->
data
;
NiceSocket
*
socket
=
socket_source
->
socket
;
NiceSocket
*
nicesock
=
socket_source
->
socket
;
if
(
g_socket_condition_check
(
socket
->
fileno
,
G_IO_IN
)
!=
0
)
{
if
(
g_socket_condition_check
(
nicesock
->
fileno
,
G_IO_IN
)
!=
0
)
{
retval
=
TRUE
;
break
;
}
...
...
agent/outputstream.c
View file @
4e9b3e12
...
...
@@ -495,9 +495,9 @@ nice_output_stream_is_writable (GPollableOutputStream *stream)
/* Check whether any of the component’s FDs are pollable. */
for
(
i
=
component
->
socket_sources
;
i
!=
NULL
;
i
=
i
->
next
)
{
SocketSource
*
socket_source
=
i
->
data
;
NiceSocket
*
socket
=
socket_source
->
socket
;
NiceSocket
*
nicesock
=
socket_source
->
socket
;
if
(
g_socket_condition_check
(
socket
->
fileno
,
G_IO_OUT
)
!=
0
)
{
if
(
g_socket_condition_check
(
nicesock
->
fileno
,
G_IO_OUT
)
!=
0
)
{
retval
=
TRUE
;
break
;
}
...
...
agent/pseudotcp.c
View file @
4e9b3e12
...
...
@@ -980,7 +980,7 @@ gint
pseudo_tcp_socket_recv
(
PseudoTcpSocket
*
self
,
char
*
buffer
,
size_t
len
)
{
PseudoTcpSocketPrivate
*
priv
=
self
->
priv
;
gsize
read
;
gsize
bytes
read
;
gsize
available_space
;
if
(
priv
->
state
!=
TCP_ESTABLISHED
)
{
...
...
@@ -991,10 +991,10 @@ pseudo_tcp_socket_recv(PseudoTcpSocket *self, char * buffer, size_t len)
if
(
len
==
0
)
return
0
;
read
=
pseudo_tcp_fifo_read
(
&
priv
->
rbuf
,
(
guint8
*
)
buffer
,
len
);
bytes
read
=
pseudo_tcp_fifo_read
(
&
priv
->
rbuf
,
(
guint8
*
)
buffer
,
len
);
// If there's no data in |m_rbuf|.
if
(
read
==
0
)
{
if
(
bytes
read
==
0
)
{
priv
->
bReadEnable
=
TRUE
;
priv
->
error
=
EWOULDBLOCK
;
return
-
1
;
...
...
@@ -1014,7 +1014,7 @@ pseudo_tcp_socket_recv(PseudoTcpSocket *self, char * buffer, size_t len)
}
}
return
read
;
return
bytes
read
;
}
gint
...
...
socket/tcp-turn.c
View file @
4e9b3e12
...
...
@@ -196,7 +196,7 @@ socket_recv_message (NiceSocket *sock, NiceInputMessage *recv_message)
}
static
gint
socket_recv_messages
(
NiceSocket
*
socket
,
socket_recv_messages
(
NiceSocket
*
nicesock
,
NiceInputMessage
*
recv_messages
,
guint
n_recv_messages
)
{
guint
i
;
...
...
@@ -205,7 +205,7 @@ socket_recv_messages (NiceSocket *socket,
for
(
i
=
0
;
i
<
n_recv_messages
;
i
++
)
{
gssize
len
;
len
=
socket_recv_message
(
socket
,
&
recv_messages
[
i
]);
len
=
socket_recv_message
(
nicesock
,
&
recv_messages
[
i
]);
recv_messages
[
i
].
length
=
MAX
(
len
,
0
);
if
(
len
<
0
)
...
...
tests/test-send-recv.c
View file @
4e9b3e12
...
...
@@ -186,7 +186,7 @@ stream_api_supports_vectored_io (StreamApi stream_api)
* Guaranteed to be in the interval [1, 1 << 16). ((1 << 16) is the maximum
* message size.) */
static
gsize
generate_buffer_size
(
BufferSizeStrategy
strategy
,
GRand
*
rand
,
generate_buffer_size
(
BufferSizeStrategy
strategy
,
GRand
*
g
rand
,
gsize
buffer_offset
)
{
switch
(
strategy
)
{
...
...
@@ -203,7 +203,7 @@ generate_buffer_size (BufferSizeStrategy strategy, GRand *rand,
return
CLAMP
(
1L
<<
buffer_offset
,
1
,
(
1
<<
16
)
-
1
);
case
BUFFER_SIZE_RANDOM
:
return
g_rand_int_range
(
rand
,
1
,
1
<<
16
);
return
g_rand_int_range
(
g
rand
,
1
,
1
<<
16
);
default:
g_assert_not_reached
();
...
...
@@ -214,7 +214,7 @@ generate_buffer_size (BufferSizeStrategy strategy, GRand *rand,
* byte. Guaranteed to be in the interval [1, 100], where 100 was chosen
* arbitrarily.*/
static
guint
generate_buffer_count
(
BufferCountStrategy
strategy
,
GRand
*
rand
,
generate_buffer_count
(
BufferCountStrategy
strategy
,
GRand
*
g
rand
,
gsize
buffer_offset
)
{
switch
(
strategy
)
{
...
...
@@ -225,7 +225,7 @@ generate_buffer_count (BufferCountStrategy strategy, GRand *rand,
return
2
;
case
BUFFER_COUNT_RANDOM
:
return
g_rand_int_range
(
rand
,
1
,
100
+
1
);
return
g_rand_int_range
(
g
rand
,
1
,
100
+
1
);
default:
g_assert_not_reached
();
...
...
@@ -236,7 +236,7 @@ generate_buffer_count (BufferCountStrategy strategy, GRand *rand,
* @buffer_offset-th byte. Guaranteed to be in the interval [1, 100], where 100
* was chosen arbitrarily.*/
static
guint
generate_message_count
(
MessageCountStrategy
strategy
,
GRand
*
rand
,
generate_message_count
(
MessageCountStrategy
strategy
,
GRand
*
g
rand
,
guint
buffer_index
)
{
switch
(
strategy
)
{
...
...
@@ -247,7 +247,7 @@ generate_message_count (MessageCountStrategy strategy, GRand *rand,
return
2
;
case
MESSAGE_COUNT_RANDOM
:
return
g_rand_int_range
(
rand
,
1
,
100
+
1
);
return
g_rand_int_range
(
g
rand
,
1
,
100
+
1
);
default:
g_assert_not_reached
();
...
...
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