summaryrefslogtreecommitdiff
path: root/socket
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2014-05-17 15:57:15 +0900
committerOlivier CrĂȘte <olivier.crete@collabora.com>2014-05-17 15:57:15 +0900
commit18e5dff4f25b12522e857c13d3ef3bdb40212246 (patch)
treeb7c9680611d54f953545d28c9068e22540fc7689 /socket
parent3507e95c00b5efdc07ca6cb079e79f17270e5dd5 (diff)
downloadlibnice-18e5dff4f25b12522e857c13d3ef3bdb40212246.tar.gz
agent: Separate reliability from ice-tcp vs ice-udp
We want ICE-TCP to not have reliable behavior unless the agent is reliable otherwise it will confuse existing VoIP applications.
Diffstat (limited to 'socket')
-rw-r--r--socket/tcp-active.c7
-rw-r--r--socket/tcp-active.h3
-rw-r--r--socket/tcp-passive.c10
-rw-r--r--socket/tcp-passive.h3
4 files changed, 17 insertions, 6 deletions
diff --git a/socket/tcp-active.c b/socket/tcp-active.c
index 374782c..643c70e 100644
--- a/socket/tcp-active.c
+++ b/socket/tcp-active.c
@@ -51,6 +51,7 @@
#endif
typedef struct {
+ gboolean reliable;
GSocketAddress *local_addr;
GMainContext *context;
} TcpActivePriv;
@@ -70,7 +71,8 @@ static void socket_set_writable_callback (NiceSocket *sock,
NiceSocket *
-nice_tcp_active_socket_new (GMainContext *ctx, NiceAddress *addr)
+nice_tcp_active_socket_new (GMainContext *ctx, NiceAddress *addr,
+ gboolean reliable)
{
union {
struct sockaddr_storage storage;
@@ -103,6 +105,7 @@ nice_tcp_active_socket_new (GMainContext *ctx, NiceAddress *addr)
sock->priv = priv = g_slice_new0 (TcpActivePriv);
+ priv->reliable = reliable;
priv->context = g_main_context_ref (ctx);
priv->local_addr = gaddr;
@@ -249,7 +252,7 @@ nice_tcp_active_socket_connect (NiceSocket *sock, NiceAddress *addr)
nice_address_set_from_sockaddr (&local_addr, &name.addr);
new_socket = nice_tcp_bsd_socket_new_from_gsock (priv->context, gsock,
- &local_addr, addr, TRUE);
+ &local_addr, addr, priv->reliable);
g_object_unref (gsock);
return new_socket;
diff --git a/socket/tcp-active.h b/socket/tcp-active.h
index cf4a0d9..beba033 100644
--- a/socket/tcp-active.h
+++ b/socket/tcp-active.h
@@ -41,7 +41,8 @@
G_BEGIN_DECLS
-NiceSocket * nice_tcp_active_socket_new (GMainContext *ctx, NiceAddress *addr);
+NiceSocket * nice_tcp_active_socket_new (GMainContext *ctx, NiceAddress *addr,
+ gboolean reliable);
NiceSocket * nice_tcp_active_socket_connect (NiceSocket *socket, NiceAddress *addr);
diff --git a/socket/tcp-passive.c b/socket/tcp-passive.c
index 2eb05dd..eeda236 100644
--- a/socket/tcp-passive.c
+++ b/socket/tcp-passive.c
@@ -51,6 +51,8 @@
#endif
typedef struct {
+ gboolean reliable;
+
GMainContext *context;
GHashTable *connections;
NiceSocketWritableCb writable_cb;
@@ -75,7 +77,8 @@ static void _set_child_callbacks (NiceAddress *addr, NiceSocket *child,
NiceSocket *sock);
NiceSocket *
-nice_tcp_passive_socket_new (GMainContext *ctx, NiceAddress *addr)
+nice_tcp_passive_socket_new (GMainContext *ctx, NiceAddress *addr,
+ gboolean reliable)
{
union {
struct sockaddr_storage storage;
@@ -149,6 +152,7 @@ nice_tcp_passive_socket_new (GMainContext *ctx, NiceAddress *addr)
nice_address_set_from_sockaddr (&sock->addr, &name.addr);
sock->priv = priv = g_slice_new0 (TcpPassivePriv);
+ priv->reliable = reliable;
priv->context = g_main_context_ref (ctx);
priv->connections = g_hash_table_new_full ((GHashFunc) nice_address_hash,
(GEqualFunc) nice_address_equal, (
@@ -217,7 +221,9 @@ static gint socket_send_messages_reliable (NiceSocket *sock,
static gboolean
socket_is_reliable (NiceSocket *sock)
{
- return TRUE;
+ TcpPassivePriv *priv = sock->priv;
+
+ return priv->reliable;
}
static gboolean
diff --git a/socket/tcp-passive.h b/socket/tcp-passive.h
index 37e780b..9be521d 100644
--- a/socket/tcp-passive.h
+++ b/socket/tcp-passive.h
@@ -43,7 +43,8 @@
G_BEGIN_DECLS
-NiceSocket * nice_tcp_passive_socket_new (GMainContext *ctx, NiceAddress *addr);
+NiceSocket * nice_tcp_passive_socket_new (GMainContext *ctx, NiceAddress *addr,
+ gboolean reliable);
NiceSocket * nice_tcp_passive_socket_accept (NiceSocket *socket);