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
dd0904d4
Commit
dd0904d4
authored
Apr 24, 2014
by
Jakub Adam
Committed by
Olivier Crête
May 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set local address of TCP-BSD socket
parent
2f319ad9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
agent/agent.c
agent/agent.c
+4
-2
socket/tcp-bsd.c
socket/tcp-bsd.c
+7
-8
socket/tcp-bsd.h
socket/tcp-bsd.h
+2
-1
No files found.
agent/agent.c
View file @
dd0904d4
...
...
@@ -1949,6 +1949,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
{
CandidateDiscovery
*
cdisco
;
Component
*
component
=
stream_find_component_by_id
(
stream
,
component_id
);
NiceAddress
local_address
;
/* note: no need to check for redundant candidates, as this is
* done later on in the process */
...
...
@@ -2008,6 +2009,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
return
;
}
local_address
=
nicesock
->
addr
;
nicesock
=
NULL
;
/* TODO: add support for turn-tcp RFC 6062 */
...
...
@@ -2016,7 +2018,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
nice_address_set_from_string
(
&
proxy_server
,
agent
->
proxy_ip
))
{
nice_address_set_port
(
&
proxy_server
,
agent
->
proxy_port
);
nicesock
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
proxy_server
,
reliable_tcp
);
&
local_address
,
reliable_tcp
);
if
(
nicesock
)
{
_priv_set_socket_tos
(
agent
,
nicesock
,
stream
->
tos
);
...
...
@@ -2035,7 +2037,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
}
if
(
nicesock
==
NULL
)
{
nicesock
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
turn
->
server
,
reliable_tcp
);
&
local_address
,
reliable_tcp
);
if
(
nicesock
)
_priv_set_socket_tos
(
agent
,
nicesock
,
stream
->
tos
);
...
...
socket/tcp-bsd.c
View file @
dd0904d4
...
...
@@ -109,7 +109,8 @@ nice_tcp_bsd_socket_new_from_gsock (GMainContext *ctx, GSocket *gsock,
}
NiceSocket
*
nice_tcp_bsd_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
remote_addr
,
gboolean
reliable
)
nice_tcp_bsd_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
remote_addr
,
NiceAddress
*
local_addr
,
gboolean
reliable
)
{
union
{
struct
sockaddr_storage
storage
;
...
...
@@ -120,7 +121,6 @@ nice_tcp_bsd_socket_new (GMainContext *ctx, NiceAddress *remote_addr, gboolean r
GError
*
gerr
=
NULL
;
gboolean
gret
=
FALSE
;
GSocketAddress
*
gaddr
;
NiceAddress
local_addr
;
if
(
remote_addr
==
NULL
)
{
/* We can't connect a tcp socket with no destination address */
...
...
@@ -172,18 +172,17 @@ nice_tcp_bsd_socket_new (GMainContext *ctx, NiceAddress *remote_addr, gboolean r
g_error_free
(
gerr
);
}
gaddr
=
g_socket_get_local_address
(
gsock
,
NULL
);
if
(
gaddr
==
NULL
||
!
g_socket_address_to_native
(
gaddr
,
&
name
.
addr
,
sizeof
(
name
),
NULL
)
)
{
nice_address_copy_to_sockaddr
(
local_addr
,
&
name
.
addr
);
gaddr
=
g_socket_address_new_from_native
(
&
name
.
addr
,
sizeof
(
name
));
if
(
gaddr
==
NULL
)
{
g_socket_close
(
gsock
,
NULL
);
g_object_unref
(
gsock
);
return
NULL
;
}
g_socket_bind
(
gsock
,
gaddr
,
FALSE
,
NULL
);
g_object_unref
(
gaddr
);
nice_address_set_from_sockaddr
(
&
local_addr
,
&
name
.
addr
);
sock
=
nice_tcp_bsd_socket_new_from_gsock
(
ctx
,
gsock
,
&
local_addr
,
remote_addr
,
sock
=
nice_tcp_bsd_socket_new_from_gsock
(
ctx
,
gsock
,
local_addr
,
remote_addr
,
reliable
);
g_object_unref
(
gsock
);
...
...
socket/tcp-bsd.h
View file @
dd0904d4
...
...
@@ -43,7 +43,8 @@ G_BEGIN_DECLS
NiceSocket
*
nice_tcp_bsd_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
remote_addr
,
gboolean
reliable
);
nice_tcp_bsd_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
remote_addr
,
NiceAddress
*
local_addr
,
gboolean
reliable
);
NiceSocket
*
nice_tcp_bsd_socket_new_from_gsock
(
GMainContext
*
ctx
,
GSocket
*
gsock
,
...
...
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