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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
0fbebf8e
Commit
0fbebf8e
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
http: cleanup, fix handling error when no logger is set
parent
24efa378
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/http.cpp
+9
-8
9 additions, 8 deletions
src/http.cpp
with
9 additions
and
8 deletions
src/http.cpp
+
9
−
8
View file @
0fbebf8e
...
@@ -758,11 +758,12 @@ Request::connect(std::vector<asio::ip::tcp::endpoint>&& endpoints, HandlerCb cb)
...
@@ -758,11 +758,12 @@ Request::connect(std::vector<asio::ip::tcp::endpoint>&& endpoints, HandlerCb cb)
this_
.
terminate
(
ec
);
this_
.
terminate
(
ec
);
return
;
return
;
}
}
else
if
(
ec
and
this_
.
logger_
)
else
if
(
ec
)
{
this_
.
logger_
->
e
(
"[http:request:%i] connect: failed with all endpoints"
,
this_
.
id_
);
else
{
if
(
this_
.
logger_
)
if
(
this_
.
logger_
)
this_
.
logger_
->
d
(
"[http:request:%i] connect success"
,
this_
.
id_
);
this_
.
logger_
->
e
(
"[http:request:%i] connect failed with all endpoints: %s"
,
this_
.
id_
,
ec
.
message
().
c_str
());
}
else
{
// if (this_.logger_)
// this_.logger_->d("[http:request:%i] connect success", this_.id_);
const
auto
&
url
=
this_
.
get_url
();
const
auto
&
url
=
this_
.
get_url
();
auto
port
=
endpoint
.
port
();
auto
port
=
endpoint
.
port
();
...
@@ -783,8 +784,8 @@ Request::connect(std::vector<asio::ip::tcp::endpoint>&& endpoints, HandlerCb cb)
...
@@ -783,8 +784,8 @@ Request::connect(std::vector<asio::ip::tcp::endpoint>&& endpoints, HandlerCb cb)
return
;
return
;
if
(
ec
and
logger
)
if
(
ec
and
logger
)
logger
->
e
(
"[http:request:%i] handshake error: %s"
,
id
,
ec
.
message
().
c_str
());
logger
->
e
(
"[http:request:%i] handshake error: %s"
,
id
,
ec
.
message
().
c_str
());
else
if
(
logger
)
//
else if (logger)
logger
->
d
(
"[http:request:%i] handshake success"
,
id
);
//
logger->d("[http:request:%i] handshake success", id);
if
(
cb
)
if
(
cb
)
cb
(
ec
);
cb
(
ec
);
});
});
...
@@ -889,8 +890,8 @@ Request::handle_request(const asio::error_code& ec)
...
@@ -889,8 +890,8 @@ Request::handle_request(const asio::error_code& ec)
terminate
(
asio
::
error
::
not_connected
);
terminate
(
asio
::
error
::
not_connected
);
return
;
return
;
}
}
if
(
logger_
)
//
if (logger_)
logger_
->
d
(
"[http:request:%i] send success"
,
id_
);
//
logger_->d("[http:request:%i] send success", id_);
// read response
// read response
notify_state_change
(
State
::
RECEIVING
);
notify_state_change
(
State
::
RECEIVING
);
...
...
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