Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
e3114cd5
Commit
e3114cd5
authored
Apr 13, 2018
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
proxy client: catch name resolving exception
parent
84894330
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dht_proxy_client.cpp
+42
-38
42 additions, 38 deletions
src/dht_proxy_client.cpp
with
42 additions
and
38 deletions
src/dht_proxy_client.cpp
+
42
−
38
View file @
e3114cd5
...
@@ -490,10 +490,11 @@ DhtProxyClient::getProxyInfos()
...
@@ -490,10 +490,11 @@ DhtProxyClient::getProxyInfos()
if
(
statusThread_
.
joinable
())
if
(
statusThread_
.
joinable
())
statusThread_
.
join
();
statusThread_
.
join
();
statusThread_
=
std
::
thread
([
this
,
serverHost
]{
statusThread_
=
std
::
thread
([
this
,
serverHost
]{
auto
hostAndService
=
splitPort
(
serverHost
);
auto
resolved_proxies
=
SockAddr
::
resolve
(
hostAndService
.
first
,
hostAndService
.
second
);
struct
SuccessCount
{
std
::
atomic_uint
ipv4
{
0
},
ipv6
{
0
};};
struct
SuccessCount
{
std
::
atomic_uint
ipv4
{
0
},
ipv6
{
0
};};
auto
successCount
=
std
::
make_shared
<
SuccessCount
>
();
auto
successCount
=
std
::
make_shared
<
SuccessCount
>
();
try
{
auto
hostAndService
=
splitPort
(
serverHost
);
auto
resolved_proxies
=
SockAddr
::
resolve
(
hostAndService
.
first
,
hostAndService
.
second
);
std
::
vector
<
std
::
future
<
Sp
<
restbed
::
Response
>>>
reqs
;
std
::
vector
<
std
::
future
<
Sp
<
restbed
::
Response
>>>
reqs
;
reqs
.
reserve
(
resolved_proxies
.
size
());
reqs
.
reserve
(
resolved_proxies
.
size
());
for
(
const
auto
&
resolved_proxy
:
resolved_proxies
)
{
for
(
const
auto
&
resolved_proxy
:
resolved_proxies
)
{
...
@@ -535,6 +536,9 @@ DhtProxyClient::getProxyInfos()
...
@@ -535,6 +536,9 @@ DhtProxyClient::getProxyInfos()
for
(
auto
&
r
:
reqs
)
for
(
auto
&
r
:
reqs
)
r
.
get
();
r
.
get
();
reqs
.
clear
();
reqs
.
clear
();
}
catch
(
const
std
::
exception
&
e
)
{
DHT_LOG
.
e
(
"Error sending proxy info request: %s"
,
e
.
what
());
}
if
(
successCount
->
ipv4
==
0
)
onProxyInfos
(
Json
::
Value
{},
AF_INET
);
if
(
successCount
->
ipv4
==
0
)
onProxyInfos
(
Json
::
Value
{},
AF_INET
);
if
(
successCount
->
ipv6
==
0
)
onProxyInfos
(
Json
::
Value
{},
AF_INET6
);
if
(
successCount
->
ipv6
==
0
)
onProxyInfos
(
Json
::
Value
{},
AF_INET6
);
ongoingStatusUpdate_
.
clear
();
ongoingStatusUpdate_
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment