Commit aeb8896d authored by Dafydd Harries's avatar Dafydd Harries
Browse files

send reciprocal connectivity checks

darcs-hash:20070205190622-c9803-08ab8f6bffcceceb4cf694427eebd1ce6cf309df.gz
parent b999bab3
......@@ -503,6 +503,31 @@ RESPOND:
stun_message_free (response);
}
{
NiceRNG *rng;
StunMessage *extra;
gchar *username;
guint len;
gchar *packed;
extra = stun_message_new (STUN_MESSAGE_BINDING_REQUEST,
NULL, 1);
username = g_strconcat (remote->username, local->username, NULL);
extra->attributes[0] = stun_attribute_username_new (username);
g_free (username);
rng = nice_rng_new ();
nice_rng_generate_bytes (rng, 16, extra->transaction_id);
nice_rng_free (rng);
len = stun_message_pack (extra, &packed);
nice_udp_socket_send (&local->sock, &from, len, packed);
g_free (packed);
stun_message_free (extra);
}
return;
ERROR:
......
......@@ -64,6 +64,24 @@ send_connectivity_check (
stun_message_free (msg);
}
{
StunMessage *msg;
NiceAddress addr = {0,};
gchar packed[1024];
gchar *dump;
guint len;
len = nice_udp_fake_socket_pop_send (sock, &addr, 1024, packed);
g_assert (nice_address_equal (&addr, remote_addr));
msg = stun_message_unpack (len, packed);
dump = stun_message_dump (msg);
g_assert (0 == strcmp (dump,
"BINDING-REQUEST ac2f75c0:43fbc367:09d315f2:245746d8\n"
" USERNAME \"usernameS9PObXR5\"\n"));
g_free (dump);
stun_message_free (msg);
}
g_free (username);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment