Commit a76e7b16 authored by Simon Morlat's avatar Simon Morlat

send outgoing keepalives for domain registrations, with config item to control interval.

fix various compilation troubles
parent 7b9429dc
......@@ -168,14 +168,19 @@ if test x$odbc != xno ; then
if test x$odbc != xauto ; then
AC_MSG_ERROR([unixodbc headers not found. This is required for enabling odbc. Use --disable-odbc if you don''t need this feature.])
fi
fi
if test x$have_sql_linking = xno ; then
odbc=no
elif test x$have_sql_linking = xno ; then
if test x$odbc != xauto ; then
AC_MSG_ERROR([Linking against odbc failed. This is required for enabling odbc. Use --disable-odbc if you don''t need this feature.])
fi
odbc=no
else
odbc=yes
fi
else
odbc=no
fi
AM_CONDITIONAL(BUILD_ODBC,test x$have_unixodbc_headers$have_sql_linking = xyesyes)
AM_CONDITIONAL(BUILD_ODBC,test x$odbc = xyes)
......@@ -452,17 +457,21 @@ if test x$redis != xno ; then
CPPFLAGS=$CPPFLAGS_save
LIBS=$LIBS_save
AC_SUBST(HIREDIS_CFLAGS)
AC_SUBST(HIREDIS_LIBS)
# when redis is not detected through pkgconfig, we can't know whether the
# connect callback uses 1 or 2 args. Better not using it at all.
redis_no_callback=yes
if test "$redis$have_redis" = "yesno" ; then
AC_MSG_ERROR([hiredis library not found.])
if test "$have_redis" = "no" ; then
HIREDIS_CFLAGS=
HIREDIS_LIBS=
if test "$redis" = "yes" ; then
AC_MSG_ERROR([hiredis library not found.])
fi
fi
fi
have_redis=yes
AC_SUBST(HIREDIS_CFLAGS)
AC_SUBST(HIREDIS_LIBS)
fi
AM_CONDITIONAL(BUILD_REDIS,test x$have_redis = xyes)
......
......@@ -22,6 +22,10 @@ using namespace std;
AuthDbBackend *AuthDbBackend::sUnique = NULL;
AuthDbListener::~AuthDbListener(){
}
class FixedAuthDb : public AuthDbBackend {
public:
FixedAuthDb() {
......
......@@ -48,6 +48,7 @@ struct AuthDbTimings;
class AuthDbListener : public StatFinishListener {
public:
virtual void onResult(AuthDbResult result, std::string passwd) = 0;
virtual ~AuthDbListener();
};
class AuthDbBackend {
......
......@@ -87,6 +87,10 @@ DomainRegistrationManager::DomainRegistrationManager(Agent *agent) : mAgent(agen
"When submitting a domain registration to a server over TLS, verify the certificate presented by the server. "
"Disabling this option is only for test, because it is a security flaw",
"true"},
{Integer, "keepalive-interval",
"Interval in seconds for sending \\r\\n\\r\\n keepalives throug the outgoing domain registration connection."
"A value of zero disables keepalives.",
"30"},
config_item_end};
domainRegistrationCfg->addChildrenValues(configs);
......@@ -155,6 +159,7 @@ int DomainRegistrationManager::load() {
} while (!ifs.eof() && !ifs.bad());
mVerifyServerCerts = domainRegistrationCfg->get<ConfigBoolean>("verify-server-certs")->read();
mKeepaliveInterval = domainRegistrationCfg->get<ConfigInt>("keepalive-interval")->read();
for_each(mRegistrations.begin(), mRegistrations.end(), mem_fn(&DomainRegistration::start));
return 0;
......@@ -190,7 +195,7 @@ DomainRegistration::DomainRegistration(DomainRegistrationManager &mgr, const str
bool usingTls;
int verifyPolicy = mgr.mVerifyServerCerts ? TPTLS_VERIFY_OUT | TPTLS_VERIFY_SUBJECTS_OUT : TPTLS_VERIFY_NONE;
nta_agent_t *agent = mManager.mAgent->getSofiaAgent();
unsigned int keepAliveInterval = 10 * 60 * 1000;
unsigned int keepAliveInterval = mgr.mKeepaliveInterval * 1000;
su_home_init(&mHome);
mFrom = url_format(&mHome, "%s:%s", parent_proxy->url_type == url_sips ? "sips" : "sip", localDomain.c_str());
......
......@@ -85,6 +85,7 @@ class DomainRegistrationManager {
private:
Agent *mAgent;
std::list<std::shared_ptr<DomainRegistration>> mRegistrations;
int mKeepaliveInterval;
bool mVerifyServerCerts;
};
......
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