gbc-tests no longer builds with derive 2.6 or later. While we
investigate that problem, pin the dependency to < 2.6 to keep gbc-tests
building.
Mitigates https://github.com/Microsoft/bond/issues/342
* Use precompiled pandoc for building documentation
Instead of building pandoc from source, we now just use Chocolately to
install a precompiled version of pandoc. This speeds up documentation
builds and prevents random breakage due to Hackage package changes.
NB: The Chocolately Pandoc 1.19.2.1 package is currently broken. It
appears to have a pre-release Pandoc 2.0 executable that doesn't
understand all the command line flags that 1.x does (e.g., --smart).
Fixes https://github.com/Microsoft/bond/issues/341
* Match Window's default path building order
The CMake cache variable BOND_LIBRARIES_INSTALL_CPP controls whether the
generated .cpp files are installed under src/. This can be used to keep the
code around for debugging purposes or to create a self-contained copy of
Bond that can be built with something other than CMake.
Before, we were only listening on IPv4 loopback. If "localhost" resolves
to [::1], we couldn't connect. Now, we listen on both of the default
IPv4 and IPv6 loopback addresses.
If the function that produces the socket itself throws, we may not have a
socket to call Shutdown and Close on. This fixes a regression introducted by
2f9aeae.
If an EpoxyListener or EpoxyTransport is shutdown between creation of a
EpoxyConnection, but before the connection was started, calling
StopAsync() on the connection would never complete, as the connection
loop needed to run to transition the connection to Disconnected.
Now, EpoxyConnection.StopAsync() can be called before the connection has
been started to clean up the network resources.
* Add the CleanupCollection<T> class to collect things that later need
to be cleaned up.
* Use CleanupCollection in EpoxyListener and EpoxyTransport to simplify
and centralize shutdown cleanup.
The pre-compiled gbc may not be called "gbc" if the user specified the
CMake variable BOND_GBC_PATH, so we need to rename it to gbc when
installing.
Closes https://github.com/Microsoft/bond/pull/324
Before, the `Connection_CanBeStoppedMultipleTimes` test was just
asserting that the connection had been shutdown once--not
twice--before asserting.
Now, we assert that both shutdowns have happened.
Closes https://github.com/Microsoft/bond/pull/321
Before this change, the build would look for pre-compiled gbc in a lot
of places on the system. It would often find gbc from a prior install of
Bond. However, this frequently causes the build to fail. Now, it only
looks for pre-compiled gbc in the directory specified by the environment
variable BOND_GBC_PATH. Alternatively, if the CMake variable
BOND_GBC_PATH is set, that will be used directly.
* Client-side connection failures now close the sockets and streams that
are created during the connection process if an error occurs while
setting up the TCP or TLS connection.
* Refactored similar code that is used in the listener so that we have
one copy of the core algorithm.
* Removed some redundant try...catch blocks that were just logging
exceptions and installed top-level connect/accept exception handles
that then log.
Closes https://github.com/Microsoft/bond/pull/295
The major classes of warnings were
* potentially uninitialized variables,
* violations of strict aliasing rules, and
* unused variables.
Potentially uninitialized variables were set to sensible defaults.
The strict aliasing violations stemmed from type punning. They were
fixed by eliminating the type punning or switching to using
`std::memcpy` to perform type punning.
Unused variable warnings stemmed from our tests and examples using
`assert()` for the check. Since `assert()` is eliminated in a release
build, these warnings were fixed by using `boost::ignore_unused`.
However, the use of `assert()` for testing makes the "check" build
target much less useful for a release build. Issue
https://github.com/Microsoft/bond/issues/291 is open to improve this.
Until then, `boost::ignore_unused`.
When initializing SchemaDef, there was a place where we were casting a
dummy `char` to a `T&`. Since the `T&` is never referenced when creating
the SchemaDef, we now create a `const T&` from `nullptr`.
Closes https://github.com/Microsoft/bond/pull/292
The `bf` C++ example is a handy utility to work with files containing
arbitrary Bond payloads. This change extends it to support files with
more than one Bond payload.
The most obvious use case is files with a sequence of records (e.g.
logs). The less obvious but very powerful scenario is extracting some
kind of header that precedes the actual Bond payload of interest. This
is possible because a Bond schema in Simple Binary protocol can be used
to model many kinds of arbitrary headers (e.g. any fixed size header
aligned to octet boundary).
The change is backward compatible and existing command line arguments
retain their old semantics. In order to process multiple payloads user
can specified multiple `--schema` and/or multiple `--from` arguments,
e.g.:
bf --from=simple --schema=header.json,payload.json file
In the above example `bf` will first use Simple Binary to decode header
in schema specified in `header.json` and then will try to guess the
protocol of the next payload (since only one `--from` argument was
specified) and decode it using schema specified by the `payload.json`
file.
Multiple values for the `--schema` and `--from` arguments can be
specified either as comma delimited values (like in the example above)
or by passing the argument multiple times, e.g.:
bf --from=fast --from=fast file
Closes https://github.com/Microsoft/bond/pull/288