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
500ae6ef
Commit
500ae6ef
authored
Aug 10, 2019
by
Seva
Browse files
Options
Downloads
Patches
Plain Diff
http: handle asio cancel delays
parent
b01d3cfc
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/opendht/http.h
+1
-0
1 addition, 0 deletions
include/opendht/http.h
src/http.cpp
+5
-1
5 additions, 1 deletion
src/http.cpp
with
6 additions
and
1 deletion
include/opendht/http.h
+
1
−
0
View file @
500ae6ef
...
@@ -294,6 +294,7 @@ private:
...
@@ -294,6 +294,7 @@ private:
Response
response_
{};
Response
response_
{};
std
::
string
request_
;
std
::
string
request_
;
std
::
atomic
<
bool
>
message_complete_
{
false
};
std
::
atomic
<
bool
>
message_complete_
{
false
};
std
::
atomic
<
bool
>
finishing_
{
false
};
std
::
unique_ptr
<
http_parser
>
parser_
;
std
::
unique_ptr
<
http_parser
>
parser_
;
std
::
unique_ptr
<
http_parser_settings
>
parser_s_
;
std
::
unique_ptr
<
http_parser_settings
>
parser_s_
;
...
...
This diff is collapsed.
Click to expand it.
src/http.cpp
+
5
−
1
View file @
500ae6ef
...
@@ -53,7 +53,6 @@ Connection::~Connection()
...
@@ -53,7 +53,6 @@ Connection::~Connection()
if
(
is_open
()){
if
(
is_open
()){
#ifdef OPENDHT_PROXY_OPENSSL
#ifdef OPENDHT_PROXY_OPENSSL
get_socket
().
cancel
();
get_socket
().
cancel
();
get_socket
().
shutdown
(
asio
::
ip
::
tcp
::
socket
::
shutdown_both
);
#endif
#endif
get_socket
().
close
();
get_socket
().
close
();
}
}
...
@@ -682,10 +681,15 @@ Request::post()
...
@@ -682,10 +681,15 @@ Request::post()
void
void
Request
::
terminate
(
const
asio
::
error_code
&
ec
)
Request
::
terminate
(
const
asio
::
error_code
&
ec
)
{
{
if
(
finishing_
.
load
())
return
;
if
(
ec
!=
asio
::
error
::
eof
and
ec
!=
asio
::
error
::
operation_aborted
)
if
(
ec
!=
asio
::
error
::
eof
and
ec
!=
asio
::
error
::
operation_aborted
)
if
(
logger_
)
if
(
logger_
)
logger_
->
e
(
"[http:request:%i] end with error: %s"
,
id_
,
ec
.
message
().
c_str
());
logger_
->
e
(
"[http:request:%i] end with error: %s"
,
id_
,
ec
.
message
().
c_str
());
finishing_
.
store
(
true
);
// close the connection cancelling the scheduled socket operations on the io_context
// close the connection cancelling the scheduled socket operations on the io_context
conn_
.
reset
();
conn_
.
reset
();
// reset the http_parser holding the data pointer to the user callbacks
// reset the http_parser holding the data pointer to the user callbacks
...
...
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