Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
889d7583
Commit
889d7583
authored
May 24, 2019
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix another AsyncPipe bug.
parent
76e35a7c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
async-io-test.c++
c++/src/kj/async-io-test.c++
+19
-0
async-io.c++
c++/src/kj/async-io.c++
+1
-1
No files found.
c++/src/kj/async-io-test.c++
View file @
889d7583
...
...
@@ -1642,6 +1642,25 @@ KJ_TEST("Userland pipe tryPumpFrom to pumpTo for same amount fulfills simultaneo
KJ_EXPECT
(
pumpPromise2
.
wait
(
ws
)
==
6
);
}
KJ_TEST
(
"Userland pipe multi-part write doesn't quit early"
)
{
kj
::
EventLoop
loop
;
WaitScope
ws
(
loop
);
auto
pipe
=
newOneWayPipe
();
auto
readPromise
=
expectRead
(
*
pipe
.
in
,
"foo"
);
kj
::
ArrayPtr
<
const
byte
>
pieces
[
2
]
=
{
"foobar"
_kj
.
asBytes
(),
"baz"
_kj
.
asBytes
()
};
auto
writePromise
=
pipe
.
out
->
write
(
pieces
);
readPromise
.
wait
(
ws
);
KJ_EXPECT
(
!
writePromise
.
poll
(
ws
));
expectRead
(
*
pipe
.
in
,
"bar"
).
wait
(
ws
);
KJ_EXPECT
(
!
writePromise
.
poll
(
ws
));
expectRead
(
*
pipe
.
in
,
"baz"
).
wait
(
ws
);
writePromise
.
wait
(
ws
);
}
constexpr
static
auto
TEE_MAX_CHUNK_SIZE
=
1
<<
14
;
// AsyncTee::MAX_CHUNK_SIZE, 16k as of this writing
...
...
c++/src/kj/async-io.c++
View file @
889d7583
...
...
@@ -692,7 +692,7 @@ private:
// Unfortunately we have to execute a separate write() for the remaining part of this
// piece, because we can't modify the pieces array.
auto
promise
=
pipe
.
write
(
restOfPiece
.
begin
(),
restOfPiece
.
size
());
if
(
pieces
.
size
()
>
0
)
{
if
(
pieces
.
size
()
==
0
)
{
// No more pieces so that's it.
return
kj
::
mv
(
promise
);
}
else
{
...
...
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