Skip to content
Snippets Groups Projects
Commit 7927f1a6 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

sipvoiplink: use thread pool for name resolution

Change-Id: I0f41dd8fdfc008b2967854fe2e0e097f67888095
parent 8080eec2
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
#include "string_utils.h" #include "string_utils.h"
#include "logger.h" #include "logger.h"
#include <opendht/thread_pool.h>
#include <pjsip/sip_endpoint.h> #include <pjsip/sip_endpoint.h>
#include <pjsip/sip_uri.h> #include <pjsip/sip_uri.h>
...@@ -1199,10 +1201,10 @@ SIPVoIPLink::resolveSrvName(const std::string &name, pjsip_transport_type_e type ...@@ -1199,10 +1201,10 @@ SIPVoIPLink::resolveSrvName(const std::string &name, pjsip_transport_type_e type
try { try {
if (s != PJ_SUCCESS || !r) { if (s != PJ_SUCCESS || !r) {
JAMI_WARN("Can't resolve \"%s\" using pjsip_endpt_resolve, trying getaddrinfo.", name.c_str()); JAMI_WARN("Can't resolve \"%s\" using pjsip_endpt_resolve, trying getaddrinfo.", name.c_str());
std::thread([=,cb=std::move(cb)](){ dht::ThreadPool::io().run([=,cb=std::move(cb)](){
auto ips = ip_utils::getAddrList(name.c_str()); auto ips = ip_utils::getAddrList(name.c_str());
runOnMainThread(std::bind(cb, ips.empty() ? std::vector<IpAddr>{} : std::move(ips))); runOnMainThread(std::bind(cb, std::move(ips)));
}).detach(); });
} else { } else {
std::vector<IpAddr> ips; std::vector<IpAddr> ips;
ips.reserve(r->count); ips.reserve(r->count);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment