fixes the port number when a new address is used

sayer/1.4-spce2.6
Raphael Coeffic 16 years ago
parent 0ea62e575b
commit 0672c66d8e

@ -1696,19 +1696,28 @@ void _trans_layer::timer_expired(timer* t, trans_bucket* bucket, sip_trans* tr)
sockaddr_storage sa;
memset(&sa,0,sizeof(sockaddr_storage));
//TODO: get the right port number
// get the next ip
if(tr->msg->h_dns.next_ip(&sa) < 0){
tr->clear_timer(STIMER_M);
return;
}
//If a SRV record is involved, the port number
// should have been set by h_dns.next_ip(...).
if(!((sockaddr_in*)&sa)->sin_port){
//Else, we copy the old port number
((sockaddr_in*)&sa)->sin_port = ((sockaddr_in*)&tr->msg->remote_ip)->sin_port;
}
// copy the new address back
memcpy(&tr->msg->remote_ip,&sa,sizeof(sockaddr_storage));
// create new branch tag
compute_branch((char*)(tr->msg->via_p1->branch.s+MAGIC_BRANCH_LEN),
tr->msg->callid->value,tr->msg->cseq->value);
// and re-send
retransmit(tr->msg);
// reset counter for timer A & E

Loading…
Cancel
Save