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
2243ba07
Commit
2243ba07
authored
Apr 02, 2014
by
Youness Alaoui
Committed by
Olivier Crête
May 15, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow tcp-bsd to act as reliable or non reliable transport and fix is_reliable on other sockets
parent
48428cda
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
12 deletions
+29
-12
agent/agent.c
agent/agent.c
+4
-2
socket/http.c
socket/http.c
+3
-1
socket/pseudossl.c
socket/pseudossl.c
+5
-3
socket/socks5.c
socket/socks5.c
+3
-1
socket/tcp-bsd.c
socket/tcp-bsd.c
+9
-2
socket/tcp-bsd.h
socket/tcp-bsd.h
+1
-2
socket/tcp-turn.c
socket/tcp-turn.c
+3
-1
socket/turn.c
socket/turn.c
+1
-0
No files found.
agent/agent.c
View file @
2243ba07
...
@@ -1788,7 +1788,8 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
...
@@ -1788,7 +1788,8 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
agent
->
proxy_ip
!=
NULL
&&
agent
->
proxy_ip
!=
NULL
&&
nice_address_set_from_string
(
&
proxy_server
,
agent
->
proxy_ip
))
{
nice_address_set_from_string
(
&
proxy_server
,
agent
->
proxy_ip
))
{
nice_address_set_port
(
&
proxy_server
,
agent
->
proxy_port
);
nice_address_set_port
(
&
proxy_server
,
agent
->
proxy_port
);
nicesock
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
proxy_server
);
nicesock
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
proxy_server
,
FALSE
);
if
(
nicesock
)
{
if
(
nicesock
)
{
_priv_set_socket_tos
(
agent
,
nicesock
,
stream
->
tos
);
_priv_set_socket_tos
(
agent
,
nicesock
,
stream
->
tos
);
...
@@ -1806,7 +1807,8 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
...
@@ -1806,7 +1807,8 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
}
}
if
(
nicesock
==
NULL
)
{
if
(
nicesock
==
NULL
)
{
nicesock
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
turn
->
server
);
nicesock
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
turn
->
server
,
FALSE
);
if
(
nicesock
)
if
(
nicesock
)
_priv_set_socket_tos
(
agent
,
nicesock
,
stream
->
tos
);
_priv_set_socket_tos
(
agent
,
nicesock
,
stream
->
tos
);
...
...
socket/http.c
View file @
2243ba07
...
@@ -598,7 +598,9 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to,
...
@@ -598,7 +598,9 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to,
static
gboolean
static
gboolean
socket_is_reliable
(
NiceSocket
*
sock
)
socket_is_reliable
(
NiceSocket
*
sock
)
{
{
return
TRUE
;
HttpPriv
*
priv
=
sock
->
priv
;
return
nice_socket_is_reliable
(
priv
->
base_socket
);
}
}
...
...
socket/pseudossl.c
View file @
2243ba07
...
@@ -201,21 +201,23 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to,
...
@@ -201,21 +201,23 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to,
/* Fast path: pass directly through to the base socket once the handshake is
/* Fast path: pass directly through to the base socket once the handshake is
* complete. */
* complete. */
if
(
priv
->
base_socket
==
NULL
)
if
(
priv
->
base_socket
==
NULL
)
return
FALSE
;
return
-
1
;
return
nice_socket_send_messages
(
priv
->
base_socket
,
to
,
messages
,
return
nice_socket_send_messages
(
priv
->
base_socket
,
to
,
messages
,
n_messages
);
n_messages
);
}
else
{
}
else
{
add_to_be_sent
(
sock
,
to
,
messages
,
n_messages
);
add_to_be_sent
(
sock
,
to
,
messages
,
n_messages
);
}
}
return
TRUE
;
return
n_messages
;
}
}
static
gboolean
static
gboolean
socket_is_reliable
(
NiceSocket
*
sock
)
socket_is_reliable
(
NiceSocket
*
sock
)
{
{
return
TRUE
;
PseudoSSLPriv
*
priv
=
sock
->
priv
;
return
nice_socket_is_reliable
(
priv
->
base_socket
);
}
}
...
...
socket/socks5.c
View file @
2243ba07
...
@@ -445,7 +445,9 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to,
...
@@ -445,7 +445,9 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to,
static
gboolean
static
gboolean
socket_is_reliable
(
NiceSocket
*
sock
)
socket_is_reliable
(
NiceSocket
*
sock
)
{
{
return
TRUE
;
Socks5Priv
*
priv
=
sock
->
priv
;
return
nice_socket_is_reliable
(
priv
->
base_socket
);
}
}
...
...
socket/tcp-bsd.c
View file @
2243ba07
...
@@ -59,6 +59,7 @@ typedef struct {
...
@@ -59,6 +59,7 @@ typedef struct {
GMainContext
*
context
;
GMainContext
*
context
;
GSource
*
io_source
;
GSource
*
io_source
;
gboolean
error
;
gboolean
error
;
gboolean
reliable
;
}
TcpPriv
;
}
TcpPriv
;
struct
to_be_sent
{
struct
to_be_sent
{
...
@@ -84,7 +85,7 @@ static gboolean socket_send_more (GSocket *gsocket, GIOCondition condition,
...
@@ -84,7 +85,7 @@ static gboolean socket_send_more (GSocket *gsocket, GIOCondition condition,
gpointer
data
);
gpointer
data
);
NiceSocket
*
NiceSocket
*
nice_tcp_bsd_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
addr
)
nice_tcp_bsd_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
addr
,
gboolean
reliable
)
{
{
union
{
union
{
struct
sockaddr_storage
storage
;
struct
sockaddr_storage
storage
;
...
@@ -171,6 +172,7 @@ nice_tcp_bsd_socket_new (GMainContext *ctx, NiceAddress *addr)
...
@@ -171,6 +172,7 @@ nice_tcp_bsd_socket_new (GMainContext *ctx, NiceAddress *addr)
priv
->
context
=
g_main_context_ref
(
ctx
);
priv
->
context
=
g_main_context_ref
(
ctx
);
priv
->
server_addr
=
*
addr
;
priv
->
server_addr
=
*
addr
;
priv
->
error
=
FALSE
;
priv
->
error
=
FALSE
;
priv
->
reliable
=
reliable
;
sock
->
type
=
NICE_SOCKET_TYPE_TCP_BSD
;
sock
->
type
=
NICE_SOCKET_TYPE_TCP_BSD
;
sock
->
fileno
=
gsock
;
sock
->
fileno
=
gsock
;
...
@@ -292,6 +294,9 @@ socket_send_message (NiceSocket *sock, const NiceOutputMessage *message)
...
@@ -292,6 +294,9 @@ socket_send_message (NiceSocket *sock, const NiceOutputMessage *message)
add_to_be_sent
(
sock
,
message
,
ret
,
message_len
,
TRUE
);
add_to_be_sent
(
sock
,
message
,
ret
,
message_len
,
TRUE
);
ret
=
message_len
;
ret
=
message_len
;
}
}
}
else
if
(
priv
->
reliable
)
{
/* Reliable TCP, so we shouldn't drop any messages or queue them */
ret
=
0
;
}
else
{
}
else
{
/* FIXME: This dropping will break http/socks5/etc
/* FIXME: This dropping will break http/socks5/etc
* We probably need a way to the upper layer to control reliability
* We probably need a way to the upper layer to control reliability
...
@@ -350,7 +355,9 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to,
...
@@ -350,7 +355,9 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to,
static
gboolean
static
gboolean
socket_is_reliable
(
NiceSocket
*
sock
)
socket_is_reliable
(
NiceSocket
*
sock
)
{
{
return
TRUE
;
TcpPriv
*
priv
=
sock
->
priv
;
return
priv
->
reliable
;
}
}
...
...
socket/tcp-bsd.h
View file @
2243ba07
...
@@ -43,8 +43,7 @@ G_BEGIN_DECLS
...
@@ -43,8 +43,7 @@ G_BEGIN_DECLS
NiceSocket
*
NiceSocket
*
nice_tcp_bsd_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
addr
);
nice_tcp_bsd_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
addr
,
gboolean
reliable
);
G_END_DECLS
G_END_DECLS
...
...
socket/tcp-turn.c
View file @
2243ba07
...
@@ -314,6 +314,8 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to,
...
@@ -314,6 +314,8 @@ socket_send_messages (NiceSocket *sock, const NiceAddress *to,
static
gboolean
static
gboolean
socket_is_reliable
(
NiceSocket
*
sock
)
socket_is_reliable
(
NiceSocket
*
sock
)
{
{
return
TRUE
;
TurnTcpPriv
*
priv
=
sock
->
priv
;
return
nice_socket_is_reliable
(
priv
->
base_socket
);
}
}
socket/turn.c
View file @
2243ba07
...
@@ -773,6 +773,7 @@ static gboolean
...
@@ -773,6 +773,7 @@ static gboolean
socket_is_reliable
(
NiceSocket
*
sock
)
socket_is_reliable
(
NiceSocket
*
sock
)
{
{
TurnPriv
*
priv
=
(
TurnPriv
*
)
sock
->
priv
;
TurnPriv
*
priv
=
(
TurnPriv
*
)
sock
->
priv
;
return
nice_socket_is_reliable
(
priv
->
base_socket
);
return
nice_socket_is_reliable
(
priv
->
base_socket
);
}
}
...
...
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