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
3c7748b7
Commit
3c7748b7
authored
Aug 30, 2018
by
Harris Hancock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement newTee()
parent
e2744f24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
async-io-test.c++
c++/src/kj/async-io-test.c++
+0
-0
async-io.c++
c++/src/kj/async-io.c++
+0
-0
async-io.h
c++/src/kj/async-io.h
+24
-0
No files found.
c++/src/kj/async-io-test.c++
View file @
3c7748b7
This diff is collapsed.
Click to expand it.
c++/src/kj/async-io.c++
View file @
3c7748b7
This diff is collapsed.
Click to expand it.
c++/src/kj/async-io.h
View file @
3c7748b7
...
...
@@ -203,6 +203,30 @@ struct CapabilityPipe {
Own
<
AsyncCapabilityStream
>
ends
[
2
];
};
struct
Tee
{
// Two AsyncInputStreams which each read the same data from some wrapped inner AsyncInputStream.
Own
<
AsyncInputStream
>
branches
[
2
];
};
Tee
newTee
(
Own
<
AsyncInputStream
>
input
,
uint64_t
limit
=
kj
::
maxValue
);
// Constructs a Tee that operates in-process. The tee buffers data if any read or pump operations is
// called on one of the two input ends. If a read or pump operation is subsequently called on the
// other input end, the buffered data is consumed.
//
// `pumpTo()` operations on the input ends will proactively read from the inner stream and block
// while writing to the output stream. While one branch has an active `pumpTo()` operation, any
// `tryRead()` operation on the other branch will not be allowed to read faster than allowed by the
// pump's backpressure. (In other words, it will never cause buffering on the pump.) Similarly, if
// there are `pumpTo()` operations active on both branches, the greater of the two backpressures is
// respected -- the two pumps progress in lockstep, and there is no buffering.
//
// At no point will a branch's buffer be allowed to grow beyond `limit` bytes. If the buffer would
// grow beyond the limit, an exception is generated, which both branches see once they have
// exhausted their buffers.
//
// It is recommended that you use a more conservative value for `limit` than the default.
class
ConnectionReceiver
{
// Represents a server socket listening on a port.
...
...
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