Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
libnice
libnice
Commits
b5b4325f
Commit
b5b4325f
authored
Oct 07, 2008
by
Youness Alaoui
Browse files
Port nice agent to the new API of NiceSocket
parent
7f8ff6c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
agent/agent-priv.h
View file @
b5b4325f
...
...
@@ -68,8 +68,6 @@ struct _NiceAgent
GObject
parent
;
/**< gobject pointer */
gboolean
full_mode
;
/**< property: full-mode */
NiceSocketFactory
*
udp_socket_factory
;
/**< property: socket factory */
NiceSocketFactory
*
relay_socket_factory
;
/**< property: socket factory */
GTimeVal
next_check_tv
;
/**< property: next conncheck timestamp */
gchar
*
stun_server_ip
;
/**< property: STUN server IP */
guint
stun_server_port
;
/**< property: STUN server port */
...
...
agent/agent.c
View file @
b5b4325f
...
...
@@ -376,11 +376,6 @@ nice_agent_init (NiceAgent *agent)
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_USE_FINGERPRINT
);
agent
->
udp_socket_factory
=
nice_socket_factory_new
(
NICE_SOCKET_FACTORY_UDP_BSD
);
agent
->
relay_socket_factory
=
nice_socket_factory_new
(
NICE_SOCKET_FACTORY_UDP_RELAY
);
agent
->
rng
=
nice_rng_new
();
priv_generate_tie_breaker
(
agent
);
...
...
@@ -1802,11 +1797,6 @@ nice_agent_dispose (GObject *object)
if
(
G_OBJECT_CLASS
(
nice_agent_parent_class
)
->
dispose
)
G_OBJECT_CLASS
(
nice_agent_parent_class
)
->
dispose
(
object
);
nice_socket_factory_free
(
agent
->
udp_socket_factory
);
agent
->
udp_socket_factory
=
NULL
;
nice_socket_factory_free
(
agent
->
relay_socket_factory
);
agent
->
relay_socket_factory
=
NULL
;
g_static_rec_mutex_free
(
&
agent
->
mutex
);
}
...
...
agent/discovery.c
View file @
b5b4325f
...
...
@@ -60,7 +60,7 @@
#include
"discovery.h"
#include
"stun/usages/bind.h"
#include
"stun/usages/turn.h"
#include
"
udp-turn
.h"
#include
"
socket
.h"
static
inline
int
priv_timer_expired
(
GTimeVal
*
restrict
timer
,
GTimeVal
*
restrict
now
)
{
...
...
@@ -306,7 +306,7 @@ NiceCandidate *discovery_add_local_host_candidate (
/* note: candidate username and password are left NULL as stream
level ufrag/password are used */
udp_socket
=
nice_socket_new
(
agent
->
udp_socket_factory
,
address
);
udp_socket
=
nice_
udp_bsd_
socket_new
(
address
);
if
(
udp_socket
)
{
gboolean
result
;
...
...
@@ -431,7 +431,6 @@ discovery_add_relay_candidate (
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_RELAYED
);
if
(
candidate
)
{
relay_socket
=
g_slice_new0
(
NiceSocket
);
if
(
relay_socket
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
)
*
1000
;
...
...
@@ -446,10 +445,11 @@ discovery_add_relay_candidate (
candidate
->
addr
=
*
address
;
/* step: link to the base candidate+socket */
if
(
nice_udp_turn_create_socket_full
(
agent
->
relay_socket_factory
,
relay_socket
,
address
,
base_socket
,
&
component
->
turn_server
,
component
->
turn_username
,
component
->
turn_password
,
priv_agent_to_udp_turn_compatibility
(
agent
)))
{
relay_socket
=
nice_udp_turn_socket_new
(
address
,
base_socket
,
&
component
->
turn_server
,
component
->
turn_username
,
component
->
turn_password
,
priv_agent_to_udp_turn_compatibility
(
agent
),
&
agent
->
mutex
);
if
(
relay_socket
)
{
candidate
->
sockptr
=
relay_socket
;
candidate
->
base_addr
=
base_socket
->
addr
;
...
...
@@ -466,12 +466,18 @@ discovery_add_relay_candidate (
result
=
priv_add_local_candidate_pruned
(
component
,
candidate
);
if
(
result
)
{
agent_signal_new_candidate
(
agent
,
candidate
);
}
else
/* error: memory allocation, or duplicate candidate */
}
else
{
/* error: memory allocation, or duplicate candidate */
errors
=
TRUE
;
}
else
/* error: socket factory make */
}
}
else
{
/* error: socket factory make */
errors
=
TRUE
;
}
else
/* error: udp socket memory allocation */
}
}
else
{
/* error: udp socket memory allocation */
errors
=
TRUE
;
}
}
/* clean up after errors */
...
...
@@ -479,7 +485,7 @@ discovery_add_relay_candidate (
if
(
candidate
)
nice_candidate_free
(
candidate
),
candidate
=
NULL
;
if
(
relay_socket
)
g_slice_free
(
NiceSocket
,
relay_socket
);
nice_socket_free
(
relay_socket
);
}
return
candidate
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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