Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
d4cf144a
Commit
d4cf144a
authored
Apr 25, 2017
by
Marcin Siodelski
Browse files
[5260] Properly handle EWOULDBLOCK and EAGAIN in Http unit tests.
parent
4f57c8d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/http/tests/listener_unittests.cc
View file @
d4cf144a
...
...
@@ -168,10 +168,21 @@ public:
[
this
,
request
](
const
boost
::
system
::
error_code
&
ec
,
std
::
size_t
bytes_transferred
)
mutable
{
if
(
ec
)
{
ADD_FAILURE
()
<<
"error occurred while connecting: "
<<
ec
.
message
();
io_service_
.
stop
();
return
;
if
(
ec
.
value
()
==
boost
::
asio
::
error
::
operation_aborted
)
{
return
;
}
else
if
((
ec
.
value
()
==
boost
::
asio
::
error
::
try_again
)
||
(
ec
.
value
()
==
boost
::
asio
::
error
::
would_block
))
{
// If we should try again make sure there is no garbage in the
// bytes_transferred.
bytes_transferred
=
0
;
}
else
{
ADD_FAILURE
()
<<
"error occurred while connecting: "
<<
ec
.
message
();
io_service_
.
stop
();
return
;
}
}
// Remove the part of the request which has been sent.
...
...
@@ -199,14 +210,21 @@ public:
std
::
size_t
bytes_transferred
)
{
if
(
ec
)
{
// IO service stopped so simply return.
if
(
ec
==
boost
::
asio
::
error
::
operation_aborted
)
{
if
(
ec
.
value
()
==
boost
::
asio
::
error
::
operation_aborted
)
{
return
;
}
// Error occurred, bail...
ADD_FAILURE
()
<<
"error occurred while receiving HTTP"
" response from the server: "
<<
ec
.
message
();
io_service_
.
stop
();
}
else
if
((
ec
.
value
()
==
boost
::
asio
::
error
::
try_again
)
||
(
ec
.
value
()
==
boost
::
asio
::
error
::
would_block
))
{
// If we should try again, make sure that there is no garbage
// in the bytes_transferred.
bytes_transferred
=
0
;
}
else
{
// Error occurred, bail...
ADD_FAILURE
()
<<
"error occurred while receiving HTTP"
" response from the server: "
<<
ec
.
message
();
io_service_
.
stop
();
}
}
if
(
bytes_transferred
>
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment