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
b72dd35a
Commit
b72dd35a
authored
Dec 09, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix EzRpc example.
parent
ef2efa98
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
12 deletions
+13
-12
ez-rpc.h
c++/src/capnp/ez-rpc.h
+11
-10
async-prelude.h
c++/src/kj/async-prelude.h
+1
-1
async.c++
c++/src/kj/async.c++
+1
-1
No files found.
c++/src/capnp/ez-rpc.h
View file @
b72dd35a
...
...
@@ -37,32 +37,33 @@ class EzRpcClient {
//
// # Cap'n Proto schema
// interface Adder {
// add @0 (left :Int32, right :Int32) -> (
result
:Int32);
// add @0 (left :Int32, right :Int32) -> (
value
:Int32);
// }
//
// // C++ client
// int main() {
//
EzRpcClient client("10.0.1.2
:3456");
// Adder::Client adder = client.
ge
tCap<Adder>("adder");
// auto request = adder.
frob
Request();
//
capnp::EzRpcClient client("localhost
:3456");
// Adder::Client adder = client.
impor
tCap<Adder>("adder");
// auto request = adder.
add
Request();
// request.setLeft(12);
// request.setRight(34);
// auto response = request.wait(client.getWaitScope());
// assert(response.get
Result
() == 46);
// auto response = request.
send().
wait(client.getWaitScope());
// assert(response.get
Value
() == 46);
// return 0;
// }
//
// // C++ server
// class AdderImpl: public Adder::Server {
// class AdderImpl
final
: public Adder::Server {
// public:
// kj::Promise<void> frob(FrobParams::Reader params, FrobResults::Builder results) {
// results.setResult(params.getLeft() + params.getRight());
// kj::Promise<void> add(AddContext context) override {
// auto params = context.getParams();
// context.getResults().setValue(params.getLeft() + params.getRight());
// return kj::READY_NOW;
// }
// };
//
// int main() {
//
EzRpcServer server("
:3456");
//
capnp::EzRpcServer server("*
:3456");
// server.exportCap("adder", kj::heap<AdderImpl>());
// kj::NEVER_DONE.wait(server.getWaitScope());
// }
...
...
c++/src/kj/async-prelude.h
View file @
b72dd35a
...
...
@@ -185,7 +185,7 @@ public:
return
Promise
<
T
>
(
false
,
neverDone
());
}
void
wait
(
WaitScope
&
waitScope
)
KJ_NORETURN
;
void
wait
(
WaitScope
&
waitScope
)
const
KJ_NORETURN
;
};
}
// namespace _ (private)
...
...
c++/src/kj/async.c++
View file @
b72dd35a
...
...
@@ -337,7 +337,7 @@ Own<PromiseNode> neverDone() {
return
kj
::
heap
<
NeverDonePromiseNode
>
();
}
void
NeverDone
::
wait
(
WaitScope
&
waitScope
)
{
void
NeverDone
::
wait
(
WaitScope
&
waitScope
)
const
{
ExceptionOr
<
Void
>
dummy
;
waitImpl
(
neverDone
(),
dummy
,
waitScope
);
KJ_UNREACHABLE
;
...
...
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