Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
ff92c49
Fix leftover handling in HTTP CONNECT implementation.
kentonv Dec 10, 2023
f234612
Add support for bazel 7.0 and clang 17
fhanau Dec 14, 2023
a89c868
as<T>() syntax sugar methods for primitive types (#1882)
mikea Dec 20, 2023
cc16921
Allow InMemoryDirectory to be backed by memfds.
kentonv Dec 23, 2023
d9c5f42
Add json-rpc-test in bazel
fhanau Dec 25, 2023
3e17170
Update brotli dependency, move it to WORKSPACE
fhanau Dec 21, 2023
9084594
[nfc] Selectively compile platform-specific code, move test helpers o…
fhanau Dec 21, 2023
b021ad2
Cleanup: Remove ez-rpc.
kentonv Dec 27, 2023
61568eb
Cleanup: Delete `KJ_THREADLOCAL_PTR`.
kentonv Dec 27, 2023
4066806
Update samples for removal of ez-rpc.
kentonv Dec 27, 2023
2df3de3
Fix InMemoryDirectory deadlock bug.
kentonv Dec 26, 2023
6917c0f
Merge pull request #1889 from capnproto/kenton/memfd-temp-file
kentonv Jan 2, 2024
146c8ce
Cleanup: LLAIOP should not own EventLoop and friends.
kentonv Dec 28, 2023
2614e25
Extend UnixEventPort on Linux to allow external polling.
kentonv Dec 28, 2023
b71827d
Add test demonstrating EventLoops changing threads.
kentonv Dec 28, 2023
5e4bbd9
Fix typos in filesystem files
justin-mp Jan 4, 2024
33c0d2c
Fix weird spacing in InMemoryDirectory constructor declaration
justin-mp Jan 4, 2024
face4c4
Merge pull request #1897 from justin-mp/jmp/filesystem-file-gardening
kentonv Jan 4, 2024
6d8f6dd
Fix typos
kentonv Jan 11, 2024
7d97224
Merge pull request #1890 from capnproto/delete-stuff
kentonv Jan 11, 2024
3b9690f
Merge pull request #1891 from capnproto/meta-event-loop
kentonv Jan 11, 2024
8871753
Merge pull request #1876 from capnproto/fix-connect-leftover
kentonv Jan 11, 2024
8c34681
Refactor some WebSocket internals to be a coroutine.
smerritt Dec 20, 2023
566791e
WebSocket: Refactor sending of pongs to allow for other control messa…
smerritt Dec 21, 2023
c0f31ae
Move GlobFilter into a separate header/unit
jasnell Jan 3, 2024
e02fb48
Add new KJ_DISALLOW_AS_COROUTINE_PARAM mechanism
jasnell Jan 13, 2024
e628e82
Merge pull request #1905 from capnproto/jsnell/add-kjdisallowincoroutine
jasnell Jan 15, 2024
7e74c89
Move GlobFilter tests into glob-filter-test.c++
jasnell Jan 13, 2024
09560a2
WebSocket: reply with Close upon receipt of an unexpected continuatio…
smerritt Jan 3, 2024
6b75731
WebSocket: reply with Close for various protocol errors.
smerritt Jan 3, 2024
bafc222
Merge pull request #1896 from smerritt/smerritt/websocket-close
smerritt Jan 16, 2024
dacb2ea
Fix spurious `expected !currentlySending` exception.
kentonv Jan 16, 2024
40a6be7
On WebSocket handshake errors, throw DISCONNECTED at server.
kentonv Jan 16, 2024
c2304a5
Merge pull request #1912 from capnproto/kenton/websocket-error
kentonv Jan 17, 2024
6d3d74a
Merge pull request #1911 from capnproto/kenton/fix-spurious-currently…
kentonv Jan 17, 2024
044300c
Update to zlib 1.3.1, switch to fetching from GitHub
fhanau Jan 22, 2024
7ac227c
Fully fix exception-masking bug in async pipe.
kentonv Jan 24, 2024
7813542
Merge pull request #1919 from capnproto/kenton/fix-async-io-cancel-ha…
kentonv Jan 24, 2024
1ebca80
Merge pull request #1895 from jasnell/jsnell/extract-glob-filter
jasnell Jan 25, 2024
a12c15a
Revert "Revert "gracefully handling http 431 error"" (#1920)
mikea Jan 26, 2024
aaed938
Fix whitespace: Replace recently-introduced tabs with spaces.
kentonv Jan 26, 2024
33e7c10
kj::Rc<T> reference counting smart pointer
mikea Jan 24, 2024
05fb077
example use of kj::Rc<T> in http.c++
mikea Jan 24, 2024
536c328
Merge pull request #1921 from capnproto/maizatskyi/2024-01-24-rc
mikea Jan 29, 2024
6c572fb
Make getPreferredExtensions pure virtual func
MellowYarker Dec 21, 2023
af4c99d
Merge pull request #1885 from capnproto/milan/ws-compress-pref
MellowYarker Jan 31, 2024
ae261d9
Assorted build system cleanup
fhanau Jan 29, 2024
9b83075
Allow custom WebSocket error handlers for kj::HttpClient.
smerritt Feb 1, 2024
79b903d
Merge pull request #1931 from smerritt/smerritt/outgoing-websocket-pr…
kentonv Feb 2, 2024
5bbef84
Merge pull request #1923 from capnproto/kenton/fix-whitespace
kentonv Feb 2, 2024
20be408
Revert "Make getPreferredExtensions pure virtual func"
MellowYarker Feb 6, 2024
453375b
Merge branch 'v2' into milan/revert-extensions
MellowYarker Feb 6, 2024
43e5b52
Merge pull request #1940 from capnproto/milan/revert-extensions
kentonv Feb 6, 2024
4e5f919
Delete code: Remove "level 1" http-over-capnp implementation.
kentonv Jan 24, 2024
8f3a65f
Refactor: Use RevocableServer instead of assertNotCanceled() for Clie…
kentonv Jan 24, 2024
324d0e7
Refactor: Coroutinize KjToCapnpHttpServiceAdapter::request() and conn…
kentonv Jan 24, 2024
4a52e69
Refactor: Avoid using RequestState for request pump failures.
kentonv Jan 24, 2024
0d2a2f2
Refactor: Eliminate HttpOverCapnpFactory::RequestState::addTask().
kentonv Jan 24, 2024
7569830
Refactor: Remove RequestState::disconnectWebSocket().
kentonv Jan 24, 2024
0952bbc
Refactor: Elimitate RequestState::holdWebSocket().
kentonv Jan 24, 2024
de4100e
Refactor: CapnpToKjWebSocketAdapter doesn't depend on RequestState.
kentonv Jan 25, 2024
bb50d1e
Delete code: HttpOverCapnpFactory::RequestState is no longer needed.
kentonv Jan 24, 2024
af54b4d
Refactor: Coroutinize CapnpToKjHttpServiceAdapter.
kentonv Jan 25, 2024
7dd54e8
Refactor: Join server-side reply task with overall request.
kentonv Jan 25, 2024
ba16574
Cleanup: Create a public `NullStream`, remove various private versions.
kentonv Jan 25, 2024
0941903
Merge pull request #1922 from capnproto/kenton/cleanup-http-over-capnp
kentonv Feb 6, 2024
b692400
kj::Arc<T> smart poiner for atomic reference counted ojbects. (#1925)
mikea Feb 7, 2024
0985926
Revert "Revert "Make getPreferredExtensions pure virtual func""
MellowYarker Feb 8, 2024
6480280
Merge pull request #1943 from capnproto/milan/ws-ext-again
MellowYarker Feb 16, 2024
41e3c5d
check for empty AggregateConnectionReceiver
vaci Feb 28, 2024
e49c1eb
test that an empty AggregateConnectionReceiver fails gracefully
vaci Mar 1, 2024
d06dda8
kj/table: fix the initialization of BTreeImpl::MaybeUnit with uint.
balusch Mar 4, 2024
f611752
Merge pull request #1953 from balusch/table-treeindex
kentonv Mar 4, 2024
06db801
Update c++/src/kj/async-io-test.c++
kentonv Mar 4, 2024
5f1d11b
capnp-rpc: retain RpcConnectionState reference in error handling lambda
jclee Mar 4, 2024
a1e55cd
Merge pull request #1954 from capnproto/jlee/rpc-shutdown-exception
jclee Mar 6, 2024
4b44577
Merge pull request #1950 from vaci/vaci/empty-agg-receiver
kentonv Mar 6, 2024
c0b4726
nitpick: fix a few typos in the comments
JonasVautherin Mar 6, 2024
e4eb188
Merge pull request #1955 from JonasVautherin/fix-comment-typos
kentonv Mar 8, 2024
4e6b53f
In ~ConcurrencyLimitingHttpClient(), crash more eagerly.
kentonv Mar 11, 2024
cf8fd4c
Merge pull request #1964 from capnproto/kenton/concurrency-limit-uaf
kentonv Mar 11, 2024
24c7498
Add AF_VSOCK support to async io
nhynes Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/quick-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
libunwind: libunwind-12-dev
steps:
- uses: actions/checkout@v2
- uses: bazelbuild/setup-bazelisk@v2
- name: install dependencies
# I observed 404s for some packages and added an `apt-get update`. Then, I observed package
# conflicts between LLVM 14 and 15, and added the line which removes LLVM 14, the default on
Expand Down
10 changes: 6 additions & 4 deletions c++/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
common --noenable_bzlmod
common --enable_platform_specific_config

build:unix --cxxopt='-std=c++20' --host_cxxopt='-std=c++20' --force_pic --verbose_failures
Expand All @@ -6,14 +7,15 @@ build:unix --cxxopt='-Wextra' --host_cxxopt='-Wextra'
build:unix --cxxopt='-Wno-strict-aliasing' --host_cxxopt='-Wno-strict-aliasing'
build:unix --cxxopt='-Wno-sign-compare' --host_cxxopt='-Wno-sign-compare'
build:unix --cxxopt='-Wno-unused-parameter' --host_cxxopt='-Wno-unused-parameter'
build:unix --cxxopt='-Wno-deprecated-this-capture' --host_cxxopt='-Wno-deprecated-this-capture'

# I needed these magic spells to build locally with clang-11 and clang-12 on Ubuntu. clang-13 and up
# work out-of-the-box.
# TODO(2.0): Remove this when we support g++ again.
build:unix --action_env=CXXFLAGS=-stdlib=libc++
build:unix --action_env=LDFLAGS=-stdlib=libc++
build:unix --action_env=BAZEL_CXXOPTS=-stdlib=libc++
build:unix --action_env=BAZEL_LINKOPTS=-lc++:-lm
build:linux --action_env=CXXFLAGS=-stdlib=libc++
build:linux --action_env=LDFLAGS=-stdlib=libc++
build:linux --action_env=BAZEL_CXXOPTS=-stdlib=libc++
build:linux --action_env=BAZEL_LINKOPTS=-lc++:-lm

build:linux --config=unix
build:macos --config=unix
Expand Down
2 changes: 1 addition & 1 deletion c++/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.2
7.0.0
12 changes: 5 additions & 7 deletions c++/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ includekj_HEADERS = \
src/kj/vector.h \
src/kj/string.h \
src/kj/string-tree.h \
src/kj/glob-filter.h \
src/kj/hash.h \
src/kj/table.h \
src/kj/map.h \
Expand All @@ -165,7 +166,6 @@ includekj_HEADERS = \
src/kj/mutex.h \
src/kj/source-location.h \
src/kj/thread.h \
src/kj/threadlocal.h \
src/kj/filesystem.h \
src/kj/async-prelude.h \
src/kj/async.h \
Expand Down Expand Up @@ -229,8 +229,7 @@ includecapnp_HEADERS = \
src/capnp/rpc-twoparty.h \
src/capnp/rpc.capnp.h \
src/capnp/rpc-twoparty.capnp.h \
src/capnp/persistent.capnp.h \
src/capnp/ez-rpc.h
src/capnp/persistent.capnp.h

includecapnpcompat_HEADERS = \
src/capnp/compat/json.h \
Expand Down Expand Up @@ -276,6 +275,7 @@ libkj_la_SOURCES= \
src/kj/string.c++ \
src/kj/string-tree.c++ \
src/kj/source-location.c++ \
src/kj/glob-filter.c++ \
src/kj/hash.c++ \
src/kj/table.c++ \
src/kj/encoding.c++ \
Expand Down Expand Up @@ -374,8 +374,7 @@ libcapnp_rpc_la_SOURCES= \
src/capnp/rpc.capnp.c++ \
src/capnp/rpc-twoparty.c++ \
src/capnp/rpc-twoparty.capnp.c++ \
src/capnp/persistent.capnp.c++ \
src/capnp/ez-rpc.c++
src/capnp/persistent.capnp.c++

libcapnp_json_la_LIBADD = libcapnp.la libkj.la $(PTHREAD_LIBS)
libcapnp_json_la_LDFLAGS = -release $(SO_VERSION) -no-undefined
Expand Down Expand Up @@ -542,7 +541,6 @@ heavy_tests = \
src/capnp/serialize-text-test.c++ \
src/capnp/rpc-test.c++ \
src/capnp/rpc-twoparty-test.c++ \
src/capnp/ez-rpc-test.c++ \
src/capnp/compat/json-test.c++ \
src/capnp/compat/websocket-rpc-test.c++ \
src/capnp/compiler/lexer-test.c++ \
Expand Down Expand Up @@ -587,10 +585,10 @@ capnp_test_SOURCES = \
src/kj/io-test.c++ \
src/kj/mutex-test.c++ \
src/kj/time-test.c++ \
src/kj/threadlocal-test.c++ \
src/kj/filesystem-test.c++ \
src/kj/filesystem-disk-test.c++ \
src/kj/test-test.c++ \
src/kj/glob-filter-test.c++ \
src/capnp/common-test.c++ \
src/capnp/blob-test.c++ \
src/capnp/endian-test.c++ \
Expand Down
18 changes: 12 additions & 6 deletions c++/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
workspace(name = "capnp-cpp")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//:build/load_br.bzl", "load_brotli")

http_archive(
name = "bazel_skylib",
Expand All @@ -16,6 +15,14 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

http_archive(
name = "brotli",
sha256 = "e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff",
strip_prefix = "brotli-1.1.0",
type = "tgz",
urls = ["https://github.com/google/brotli/archive/refs/tags/v1.1.0.tar.gz"],
)

http_archive(
name = "ssl",
sha256 = "873ec711658f65192e9c58554ce058d1cfa4e57e13ab5366ee16f76d1c757efc",
Expand All @@ -38,6 +45,7 @@ cc_library(
"-Dverbose=-1",
] + select({
"@platforms//os:macos": [ "-Wno-implicit-function-declaration" ],
"@platforms//os:linux": [ "-Wno-implicit-function-declaration" ],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
Expand All @@ -47,9 +55,7 @@ cc_library(
http_archive(
name = "zlib",
build_file_content = _zlib_build,
sha256 = "8a9ba2898e1d0d774eca6ba5b4627a11e5588ba85c8851336eb38de4683050a7",
strip_prefix = "zlib-1.3",
urls = ["https://zlib.net/zlib-1.3.tar.xz"],
sha256 = "38ef96b8dfe510d42707d9c781877914792541133e1870841463bfa73f883e32",
strip_prefix = "zlib-1.3.1",
urls = ["https://zlib.net/zlib-1.3.1.tar.xz"],
)

load_brotli()
2 changes: 1 addition & 1 deletion c++/build/configure.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "int_flag")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

def kj_configure():
"""Generates set of flag, settings for kj configuration.
Expand Down
12 changes: 0 additions & 12 deletions c++/build/load_br.bzl

This file was deleted.

22 changes: 18 additions & 4 deletions c++/samples/calculator-client.c++
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
// THE SOFTWARE.

#include "calculator.capnp.h"
#include <capnp/ez-rpc.h>
#include <kj/async-io.h>
#include <capnp/rpc-twoparty.h>
#include <kj/debug.h>
#include <math.h>
#include <iostream>
Expand All @@ -47,13 +48,26 @@ int main(int argc, const char* argv[]) {
return 1;
}

capnp::EzRpcClient client(argv[1]);
Calculator::Client calculator = client.getMain<Calculator>();
// First we need to set up the KJ async event loop. This should happen one
// per thread that needs to perform RPC.
auto io = kj::setupAsyncIo();

// Keep an eye on `waitScope`. Whenever you see it used is a place where we
// stop and wait for the server to respond. If a line of code does not use
// `waitScope`, then it does not block!
auto& waitScope = client.getWaitScope();
auto& waitScope = io.waitScope;

// Using KJ APIs, let's parse our network address and connect to it.
kj::Network& network = io.provider->getNetwork();
kj::Own<kj::NetworkAddress> addr = network.parseAddress(argv[1]).wait(waitScope);
kj::Own<kj::AsyncIoStream> conn = addr->connect().wait(waitScope);

// Now we can start the Cap'n Proto RPC system on this connection.
capnp::TwoPartyClient client(*conn);

// The server exports a "bootstrap" capability implementing the
// `Calculator` interface.
Calculator::Client calculator = client.bootstrap().castAs<Calculator>();

{
// Make a request that just evaluates the literal value 123.
Expand Down
21 changes: 15 additions & 6 deletions c++/samples/calculator-server.c++
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
// THE SOFTWARE.

#include "calculator.capnp.h"
#include <kj/async-io.h>
#include <capnp/rpc-twoparty.h>
#include <kj/debug.h>
#include <capnp/ez-rpc.h>
#include <capnp/message.h>
#include <iostream>

Expand Down Expand Up @@ -196,12 +197,17 @@ int main(int argc, const char* argv[]) {
return 1;
}

// Set up a server.
capnp::EzRpcServer server(kj::heap<CalculatorImpl>(), argv[1]);
// First we need to set up the KJ async event loop. This should happen one
// per thread that needs to perform RPC.
auto io = kj::setupAsyncIo();

// Using KJ APIs, let's parse our network address and listen on it.
kj::Network& network = io.provider->getNetwork();
kj::Own<kj::NetworkAddress> addr = network.parseAddress(argv[1]).wait(io.waitScope);
kj::Own<kj::ConnectionReceiver> listener = addr->listen();

// Write the port number to stdout, in case it was chosen automatically.
auto& waitScope = server.getWaitScope();
uint port = server.getPort().wait(waitScope);
uint port = listener->getPort();
if (port == 0) {
// The address format "unix:/path/to/socket" opens a unix domain socket,
// in which case the port will be zero.
Expand All @@ -210,6 +216,9 @@ int main(int argc, const char* argv[]) {
std::cout << "Listening on port " << port << "..." << std::endl;
}

// Start the RPC server.
capnp::TwoPartyServer server(kj::heap<CalculatorImpl>());

// Run forever, accepting connections and handling requests.
kj::NEVER_DONE.wait(waitScope);
server.listen(*listener).wait(io.waitScope);
}
3 changes: 0 additions & 3 deletions c++/src/capnp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ cc_library(
srcs = [
"capability.c++",
"dynamic-capability.c++",
"ez-rpc.c++",
"membrane.c++",
"persistent.capnp.c++",
"reconnect.c++",
Expand All @@ -71,7 +70,6 @@ cc_library(
"serialize-async.c++",
],
hdrs = [
"ez-rpc.h",
"persistent.capnp.h",
"reconnect.h",
"rpc.capnp.h",
Expand Down Expand Up @@ -231,7 +229,6 @@ cc_library(
"dynamic-test.c++",
"encoding-test.c++",
"endian-test.c++",
"ez-rpc-test.c++",
"layout-test.c++",
"membrane-test.c++",
"message-test.c++",
Expand Down
3 changes: 0 additions & 3 deletions c++/src/capnp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ set(capnp-rpc_sources
rpc-twoparty.c++
rpc-twoparty.capnp.c++
persistent.capnp.c++
ez-rpc.c++
)
set(capnp-rpc_headers
rpc-prelude.h
Expand All @@ -96,7 +95,6 @@ set(capnp-rpc_headers
rpc.capnp.h
rpc-twoparty.capnp.h
persistent.capnp.h
ez-rpc.h
)
set(capnp-rpc_schemas
rpc.capnp
Expand Down Expand Up @@ -292,7 +290,6 @@ if(BUILD_TESTING)
serialize-text-test.c++
rpc-test.c++
rpc-twoparty-test.c++
ez-rpc-test.c++
compiler/lexer-test.c++
compiler/type-id-test.c++
test-util.c++
Expand Down
2 changes: 1 addition & 1 deletion c++/src/capnp/arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class BuilderArena final: public Arena {

SegmentBuilder* addExternalSegment(kj::ArrayPtr<const word> content);
// Add a new segment to the arena which points to some existing memory region. The segment is
// assumed to be completley full; the arena will never allocate from it. In fact, the segment
// assumed to be completely full; the arena will never allocate from it. In fact, the segment
// is considered read-only. Any attempt to get a Builder pointing into this segment will throw
// an exception. Readers are allowed, however.
//
Expand Down
2 changes: 1 addition & 1 deletion c++/src/capnp/capability.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Request: public Params::Builder {
// to complete (and possibly other things, if that RPC itself returned a promise capability),
// but when using `sendPipelineOnly()`, `whenResolved()` may complete immediately, or never, or
// at an arbitrary time. Do not rely on it.
// - Normal path shortening may not work with these capabilities. For exmaple, if the caller
// - Normal path shortening may not work with these capabilities. For example, if the caller
// forwards a pipelined capability back to the callee's vat, calls made by the callee to that
// capability may continue to proxy through the caller. Conversely, if the callee ends up
// returning a capability that points back to the caller's vat, calls on the pipelined
Expand Down
3 changes: 3 additions & 0 deletions c++/src/capnp/cc_capnp_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def cc_capnp_library(
data = [],
deps = [],
src_prefix = "",
tags = ["off-by-default"],
visibility = None,
target_compatible_with = None,
**kwargs):
Expand Down Expand Up @@ -122,6 +123,8 @@ def cc_capnp_library(
srcs = srcs_cpp,
hdrs = hdrs,
deps = deps + ["@capnp-cpp//src/capnp:capnp_runtime"],
# Allows us to avoid building the library archive when using start_end_lib
tags = tags,
visibility = visibility,
target_compatible_with = target_compatible_with,
**kwargs
Expand Down
Loading