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
b8c2ff8a
Commit
b8c2ff8a
authored
Jun 25, 2019
by
Seva
Browse files
Options
Downloads
Patches
Plain Diff
dhtproxy: cleanup client handle proxy status
parent
1fad1b9c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dht_proxy_client.cpp
+4
-10
4 additions, 10 deletions
src/dht_proxy_client.cpp
with
4 additions
and
10 deletions
src/dht_proxy_client.cpp
+
4
−
10
View file @
b8c2ff8a
...
@@ -589,7 +589,7 @@ DhtProxyClient::handleProxyStatus(const asio::error_code &ec,
...
@@ -589,7 +589,7 @@ DhtProxyClient::handleProxyStatus(const asio::error_code &ec,
{
{
if
(
ec
){
if
(
ec
){
if
(
logger_
){
if
(
logger_
){
logger_
->
e
(
"[proxy:status] handling error: %s"
,
ec
.
message
().
c_str
());
logger_
->
e
(
"[proxy:
client] [
status] handling error: %s"
,
ec
.
message
().
c_str
());
return
;
return
;
}
}
}
}
...
@@ -608,11 +608,6 @@ DhtProxyClient::handleProxyStatus(const asio::error_code &ec,
...
@@ -608,11 +608,6 @@ DhtProxyClient::handleProxyStatus(const asio::error_code &ec,
for
(
const
auto
&
resolvedProxy
:
resolvedProxies
){
for
(
const
auto
&
resolvedProxy
:
resolvedProxies
){
auto
server
=
resolvedProxy
.
toString
();
auto
server
=
resolvedProxy
.
toString
();
//if (resolvedProxy.getFamily() == AF_INET6) {
// TODO verify with asio http class; if not, add handling there
// HACK restbed seems to not correctly handle directly http://[ipv6]
// See https://github.com/Corvusoft/restbed/issues/290.
//server = endpointStr;
// make an http header
// make an http header
restinio
::
http_request_header_t
header
;
restinio
::
http_request_header_t
header
;
header
.
request_target
(
"/"
);
header
.
request_target
(
"/"
);
...
@@ -621,8 +616,7 @@ DhtProxyClient::handleProxyStatus(const asio::error_code &ec,
...
@@ -621,8 +616,7 @@ DhtProxyClient::handleProxyStatus(const asio::error_code &ec,
auto
request
=
httpClient_
->
create_request
(
header
,
header_fields
,
auto
request
=
httpClient_
->
create_request
(
header
,
header_fields
,
restinio
::
http_connection_header_t
::
keep_alive
,
""
/*body*/
);
restinio
::
http_connection_header_t
::
keep_alive
,
""
/*body*/
);
if
(
logger_
)
if
(
logger_
)
logger_
->
w
(
request
.
c_str
());
logger_
->
d
(
"[proxy:client] [status] sending request:
\n
%s"
,
request
.
c_str
());
// initalise the parser callback data
// initalise the parser callback data
struct
GetContext
{
struct
GetContext
{
unsigned
int
family
;
unsigned
int
family
;
...
@@ -661,7 +655,7 @@ DhtProxyClient::handleProxyStatus(const asio::error_code &ec,
...
@@ -661,7 +655,7 @@ DhtProxyClient::handleProxyStatus(const asio::error_code &ec,
auto
context
=
static_cast
<
GetContext
*>
(
parser
->
data
);
auto
context
=
static_cast
<
GetContext
*>
(
parser
->
data
);
if
(
parser
->
status_code
!=
200
){
if
(
parser
->
status_code
!=
200
){
if
(
context
->
logger
)
if
(
context
->
logger
)
context
->
logger
->
e
(
"[proxy:client]
proxy
status error: %i"
,
parser
->
status_code
);
context
->
logger
->
e
(
"[proxy:client]
[
status
]
error: %i"
,
parser
->
status_code
);
context
->
ok
=
true
;
context
->
ok
=
true
;
}
}
return
0
;
return
0
;
...
@@ -683,7 +677,7 @@ DhtProxyClient::handleProxyStatus(const asio::error_code &ec,
...
@@ -683,7 +677,7 @@ DhtProxyClient::handleProxyStatus(const asio::error_code &ec,
}
}
catch
(
const
std
::
exception
&
e
)
{
catch
(
const
std
::
exception
&
e
)
{
if
(
context
->
logger
)
if
(
context
->
logger
)
context
->
logger
->
e
(
"[proxy:client]
proxy
status body error: %s"
,
e
.
what
());
context
->
logger
->
e
(
"[proxy:client]
[
status
]
body error: %s"
,
e
.
what
());
context
->
ok
=
false
;
context
->
ok
=
false
;
return
1
;
return
1
;
}
}
...
...
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
register
or
sign in
to comment