@ -4,6 +4,7 @@
# include <glib.h>
# include <glib.h>
# include <errno.h>
# include <errno.h>
# include <netinet/in.h>
# include <netinet/in.h>
# include <stdbool.h>
# include "str.h"
# include "str.h"
# include "ice.h"
# include "ice.h"
# include "socket.h"
# include "socket.h"
@ -1798,6 +1799,12 @@ static int media_packet_address_check(struct packet_handler_ctx *phc)
goto out ;
goto out ;
}
}
/* wait at least 3 seconds after last signal before committing to a particular
* endpoint address */
bool wait_time = false ;
if ( ! phc - > mp . call - > last_signal | | rtpe_now . tv_sec < = phc - > mp . call - > last_signal + 3 )
wait_time = true ;
const struct endpoint * use_endpoint_confirm = & phc - > mp . fsin ;
const struct endpoint * use_endpoint_confirm = & phc - > mp . fsin ;
if ( rtpe_config . endpoint_learning = = EL_IMMEDIATE )
if ( rtpe_config . endpoint_learning = = EL_IMMEDIATE )
@ -1836,9 +1843,7 @@ static int media_packet_address_check(struct packet_handler_ctx *phc)
}
}
}
}
/* wait at least 3 seconds after last signal before committing to a particular
if ( wait_time )
* endpoint address */
if ( ! phc - > mp . call - > last_signal | | rtpe_now . tv_sec < = phc - > mp . call - > last_signal + 3 )
goto update_peerinfo ;
goto update_peerinfo ;
confirm_now :
confirm_now :
@ -1851,11 +1856,18 @@ confirm_now:
update_peerinfo :
update_peerinfo :
mutex_lock ( & phc - > mp . stream - > out_lock ) ;
mutex_lock ( & phc - > mp . stream - > out_lock ) ;
endpoint = phc - > mp . stream - > endpoint ;
// if we're during the wait time, check the received address against the previously
phc - > mp . stream - > endpoint = * use_endpoint_confirm ;
// learned address. if they're the same, ignore this packet for learning purposes
if ( memcmp ( & endpoint , & phc - > mp . stream - > endpoint , sizeof ( endpoint ) ) ) {
if ( ! wait_time | | ! phc - > mp . stream - > learned_endpoint . address . family | |
phc - > unkernelize = 1 ;
memcmp ( use_endpoint_confirm , & phc - > mp . stream - > learned_endpoint , sizeof ( endpoint ) ) )
phc - > update = 1 ;
{
endpoint = phc - > mp . stream - > endpoint ;
phc - > mp . stream - > endpoint = * use_endpoint_confirm ;
phc - > mp . stream - > learned_endpoint = * use_endpoint_confirm ;
if ( memcmp ( & endpoint , & phc - > mp . stream - > endpoint , sizeof ( endpoint ) ) ) {
phc - > unkernelize = 1 ;
phc - > update = 1 ;
}
}
}
update_addr :
update_addr :
mutex_unlock ( & phc - > mp . stream - > out_lock ) ;
mutex_unlock ( & phc - > mp . stream - > out_lock ) ;