Commit bd6a9737 authored by Simon Morlat's avatar Simon Morlat

use exosip_reset_transport when possible

parent 97671121
......@@ -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 [],
......
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