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
3b85e1c1
Commit
3b85e1c1
authored
Apr 24, 2018
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address Harris' review comments.
parent
76104a88
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
http.c++
c++/src/kj/compat/http.c++
+14
-2
http.h
c++/src/kj/compat/http.h
+1
-1
No files found.
c++/src/kj/compat/http.c++
View file @
3b85e1c1
...
...
@@ -2435,6 +2435,16 @@ public:
};
class
WebSocketPipeImpl
final
:
public
AbortableWebSocket
,
public
kj
::
Refcounted
{
// Represents one direction of a WebSocket pipe.
//
// This class behaves as a "loopback" WebSocket: a message sent using send() is received using
// receive(), on the same object. This is *not* how WebSocket implementations usually behave.
// But, this object is actually used to implement only one direction of a bidirectional pipe. At
// another layer above this, the pipe is actually composed of two WebSocketPipeEnd instances,
// which layer on top of two WebSocketPipeImpl instances representing the two directions. So,
// send() calls on a WebSocketPipeImpl instance always come from one of the two WebSocketPipeEnds
// while receive() calls come from the other end.
public
:
~
WebSocketPipeImpl
()
noexcept
(
false
)
{
KJ_REQUIRE
(
state
==
nullptr
||
ownState
.
get
()
!=
nullptr
,
...
...
@@ -2508,8 +2518,9 @@ public:
private
:
kj
::
Maybe
<
AbortableWebSocket
&>
state
;
// Represents the state of the rendezvous for this end's send() calls / the other end's
// receive() calls. (otherEnd.sendState provides the reverse state.)
// Object-oriented state! If any method call is blocked waiting on activity from the other end,
// then `state` is non-null and method calls should be forwarded to it. If no calls are
// outstanding, `state` is null.
kj
::
Own
<
AbortableWebSocket
>
ownState
;
...
...
@@ -2736,6 +2747,7 @@ private:
kj
::
Maybe
<
kj
::
Promise
<
void
>>
tryPumpFrom
(
WebSocket
&
other
)
override
{
KJ_REQUIRE
(
canceler
.
isEmpty
(),
"already pumping"
);
return
canceler
.
wrap
(
other
.
receive
().
then
([
this
,
&
other
](
Message
message
)
{
canceler
.
release
();
fulfiller
.
fulfill
(
kj
::
mv
(
message
));
pipe
.
endState
(
*
this
);
return
other
.
pumpTo
(
pipe
);
...
...
c++/src/kj/compat/http.h
View file @
3b85e1c1
...
...
@@ -646,7 +646,7 @@ struct WebSocketPipe {
WebSocketPipe
newWebSocketPipe
();
// Create a WebSocket pipe. Messages written to one end of the pipe will be readable from the other
// end. No buffering occurs -- a message send does not complete un
der
a corresponding receive
// end. No buffering occurs -- a message send does not complete un
til
a corresponding receive
// accepts the message.
struct
HttpServerSettings
{
...
...
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