mirror of
https://github.com/coturn/coturn.git
synced 2025-10-31 23:11:28 +01:00
Mobility ticket retransmission fixed.
This commit is contained in:
parent
e8e571778a
commit
4f94e42494
@ -1,6 +1,7 @@
|
||||
08/22/2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||
Version 4.1.2.2 'Vitari':
|
||||
- SHA-256 memory leak fixed.
|
||||
- SHA-256 memory leak fixed.
|
||||
- Mobility ticket retransmission fixed.
|
||||
|
||||
08/14/2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||
Version 4.1.2.1 'Vitari':
|
||||
|
||||
@ -665,6 +665,11 @@ static int clnet_allocate(int verbose,
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "refresh sent\n");
|
||||
}
|
||||
refresh_sent = 1;
|
||||
|
||||
if(clnet_info->s_mobile_id[0]) {
|
||||
usleep(10000);
|
||||
send_buffer(clnet_info, &message, 0,0);
|
||||
}
|
||||
} else {
|
||||
perror("send");
|
||||
exit(1);
|
||||
@ -682,6 +687,10 @@ static int clnet_allocate(int verbose,
|
||||
|
||||
int len = recv_buffer(clnet_info, &message, 1, 0);
|
||||
|
||||
if(clnet_info->s_mobile_id[0]) {
|
||||
len = recv_buffer(clnet_info, &message, 1, 0);
|
||||
}
|
||||
|
||||
if (len > 0) {
|
||||
if (verbose) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO,
|
||||
|
||||
@ -1411,9 +1411,6 @@ static int handle_turn_refresh(turn_turnserver *server,
|
||||
if(!(*(server->mobility))) {
|
||||
*err_code = 405;
|
||||
*reason = (const u08bits *)"Mobility forbidden";
|
||||
} if(is_allocation_valid(a)) {
|
||||
*err_code = 400;
|
||||
*reason = (const u08bits *)"Mobility ticket cannot be used for a stable, already established allocation";
|
||||
} else {
|
||||
int smid_len = stun_attr_get_len(sar);
|
||||
if(smid_len>0 && (((size_t)smid_len)<sizeof(smid))) {
|
||||
@ -1421,6 +1418,10 @@ static int handle_turn_refresh(turn_turnserver *server,
|
||||
if(smid_val) {
|
||||
ns_bcopy(smid_val, smid, (size_t)smid_len);
|
||||
mid = string_to_mobile_id(smid);
|
||||
if(is_allocation_valid(a) && (mid != ss->old_mobile_id)) {
|
||||
*err_code = 400;
|
||||
*reason = (const u08bits *)"Mobility ticket cannot be used for a stable, already established allocation";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
*err_code = 400;
|
||||
@ -1610,6 +1611,7 @@ static int handle_turn_refresh(turn_turnserver *server,
|
||||
//Use new buffer and redefine ss:
|
||||
nbh = ioa_network_buffer_allocate(server->e);
|
||||
ss = orig_ss;
|
||||
ss->old_mobile_id = mid;
|
||||
size_t len = ioa_network_buffer_get_size(nbh);
|
||||
|
||||
turn_report_allocation_set(&(ss->alloc), lifetime, 1);
|
||||
@ -1699,10 +1701,18 @@ static int handle_turn_refresh(turn_turnserver *server,
|
||||
|
||||
size_t len = ioa_network_buffer_get_size(nbh);
|
||||
stun_init_success_response_str(STUN_METHOD_REFRESH, ioa_network_buffer_data(nbh), &len, tid);
|
||||
u32bits lt = nswap32(lifetime);
|
||||
|
||||
if(ss->s_mobile_id[0]) {
|
||||
stun_attr_add_str(ioa_network_buffer_data(nbh), &len,
|
||||
STUN_ATTRIBUTE_MOBILITY_TICKET,
|
||||
(u08bits*)ss->s_mobile_id,strlen(ss->s_mobile_id));
|
||||
ioa_network_buffer_set_size(nbh,len);
|
||||
}
|
||||
|
||||
u32bits lt = nswap32(lifetime);
|
||||
stun_attr_add_str(ioa_network_buffer_data(nbh), &len, STUN_ATTRIBUTE_LIFETIME,
|
||||
(const u08bits*) <, 4);
|
||||
|
||||
ioa_network_buffer_set_size(nbh,len);
|
||||
|
||||
*resp_constructed = 1;
|
||||
|
||||
@ -97,6 +97,7 @@ struct _ts_ur_super_session {
|
||||
/* Mobile */
|
||||
int is_mobile;
|
||||
mobile_id_t mobile_id;
|
||||
mobile_id_t old_mobile_id;
|
||||
char s_mobile_id[33];
|
||||
/* Realm */
|
||||
realm_options_t realm_options;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user