mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 00:29:21 +00:00
use exosip_reset_transport when possible
This commit is contained in:
parent
9767112193
commit
bd6a973748
4 changed files with 33 additions and 14 deletions
|
|
@ -4678,11 +4678,8 @@ static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t cu
|
|||
lc->netup_time=curtime;
|
||||
lc->network_reachable=isReachable;
|
||||
if(!isReachable) {
|
||||
sal_unlisten_ports (lc->sal);
|
||||
} else {
|
||||
apply_transports(lc);
|
||||
sal_reset_transports(lc->sal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void linphone_core_refresh_registers(LinphoneCore* lc) {
|
||||
|
|
|
|||
|
|
@ -321,6 +321,7 @@ void sal_auth_info_delete(const SalAuthInfo* auth_info);
|
|||
void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs);
|
||||
int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure);
|
||||
int sal_unlisten_ports(Sal *ctx);
|
||||
int sal_reset_transports(Sal *ctx);
|
||||
ortp_socket_t sal_get_socket(Sal *ctx);
|
||||
void sal_set_user_agent(Sal *ctx, const char *user_agent);
|
||||
/*keepalive period in ms*/
|
||||
|
|
|
|||
|
|
@ -353,6 +353,32 @@ int sal_unlisten_ports(Sal *ctx){
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sal_reset_transports(Sal *ctx){
|
||||
#ifdef HAVE_EXOSIP_RESET_TRANSPORTS
|
||||
if (ctx->running){
|
||||
ms_message("Exosip transports reset.");
|
||||
eXosip_reset_transports();
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
ms_warning("sal_reset_transports() not implemented in this version.");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void set_tls_options(Sal *ctx){
|
||||
if (ctx->rootCa) {
|
||||
eXosip_tls_ctx_t tlsCtx;
|
||||
memset(&tlsCtx, 0, sizeof(tlsCtx));
|
||||
snprintf(tlsCtx.root_ca_cert, sizeof(tlsCtx.client.cert), "%s", ctx->rootCa);
|
||||
eXosip_set_tls_ctx(&tlsCtx);
|
||||
}
|
||||
#ifdef HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE
|
||||
eXosip_tls_verify_certificate(ctx->verify_server_certs);
|
||||
#endif
|
||||
}
|
||||
|
||||
int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure){
|
||||
int err;
|
||||
bool_t ipv6;
|
||||
|
|
@ -369,16 +395,7 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i
|
|||
proto= IPPROTO_TCP;
|
||||
keepalive=-1;
|
||||
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE,&keepalive);
|
||||
|
||||
if (ctx->rootCa) {
|
||||
eXosip_tls_ctx_t tlsCtx;
|
||||
memset(&tlsCtx, 0, sizeof(tlsCtx));
|
||||
snprintf(tlsCtx.root_ca_cert, sizeof(tlsCtx.client.cert), "%s", ctx->rootCa);
|
||||
eXosip_set_tls_ctx(&tlsCtx);
|
||||
}
|
||||
#ifdef HAVE_EXOSIP_TLS_VERIFY_CERTIFICATE
|
||||
eXosip_tls_verify_certificate(ctx->verify_server_certs);
|
||||
#endif
|
||||
set_tls_options(ctx);
|
||||
break;
|
||||
default:
|
||||
ms_warning("unexpected proto, using datagram");
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ AC_CHECK_LIB([eXosip2],[eXosip_trylock],
|
|||
[AC_DEFINE([HAVE_EXOSIP_TRYLOCK],[1],[Defined when eXosip_get_socket is available])],
|
||||
[],
|
||||
[-losipparser2 -losip2 ])
|
||||
AC_CHECK_LIB([eXosip2],[eXosip_reset_transports],
|
||||
[AC_DEFINE([HAVE_EXOSIP_RESET_TRANSPORTS],[1],[Defined when eXosip_reset_transports is available])],
|
||||
[],
|
||||
[-losipparser2 -losip2 ])
|
||||
dnl AC_CHECK_LIB([eXosip2],[eXosip_get_naptr],
|
||||
dnl [AC_DEFINE([HAVE_EXOSIP_NAPTR_SUPPORT],[1],[Defined when eXosip_get_naptr is available])],
|
||||
dnl [],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue