summaryrefslogtreecommitdiff
path: root/pjlib-util/src/pjstun-srv-test/usage.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-03-10 23:15:36 +0000
committerBenny Prijono <bennylp@teluu.com>2007-03-10 23:15:36 +0000
commit64f5af70111821e4319624057b9271066591935c (patch)
tree793e5ce1f06c2597cc05f73561d3bfbf270f5601 /pjlib-util/src/pjstun-srv-test/usage.c
parentfc33da579874f81621521875f9e4cffda0a327b1 (diff)
Completed and tested (simple test) the TURN server and command line STUN/TURN client
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1054 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib-util/src/pjstun-srv-test/usage.c')
-rw-r--r--pjlib-util/src/pjstun-srv-test/usage.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pjlib-util/src/pjstun-srv-test/usage.c b/pjlib-util/src/pjstun-srv-test/usage.c
index 198e0313..a8a5c274 100644
--- a/pjlib-util/src/pjstun-srv-test/usage.c
+++ b/pjlib-util/src/pjstun-srv-test/usage.c
@@ -82,8 +82,6 @@ PJ_DEF(pj_status_t) pj_stun_usage_create( pj_stun_server *srv,
if (status != PJ_SUCCESS)
goto on_error;
- pj_memcpy(&usage->cb, cb, sizeof(*cb));
-
usage->type = type;
status = pj_sock_socket(family, type, protocol, &usage->sock);
if (status != PJ_SUCCESS)
@@ -133,6 +131,12 @@ PJ_DEF(pj_status_t) pj_stun_usage_create( pj_stun_server *srv,
pj_stun_server_register_usage(srv, usage);
+ /* Only after everything has been initialized we copy the callback,
+ * to prevent callback from being called when we encounter error
+ * during initialiation (decendant would not expect this).
+ */
+ pj_memcpy(&usage->cb, cb, sizeof(*cb));
+
*p_usage = usage;
return PJ_SUCCESS;