Query::isSatisfiedBy() considers an unfiltered answer sufficient for a
filtered query, which is true for a vanilla get: onGetValuesDone() applies
the operation filter to the values before calling back.
A projected query is different. It receives the fields another query selected
and can no longer evaluate its own filters on them, all the more so as those
filters may target fields that were not selected at all. Two concurrent
queries such as "SELECT id" and "SELECT id WHERE value_type=1" therefore made
the filtered callback report identifiers whose type does not match, and
searchNodeGetDone() additionally cancelled its own request so it never got a
correctly filtered answer.
Add Query::isProjectionSatisfiedBy(), which additionally requires both queries
to apply the same filters, and use it for operations with a query callback.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
containedIn() only checked that the other index declared the same field
keys, never that they held the same values, contradicting its documented
contract of containment "with the same value".
Dht::query() uses containedIn() to deduplicate projected results. Because
every result of a given query shares the same projection schema, any two
results compared equal: the first one suppressed all the later ones, and the
"lesser" branch even erased the already reported result. A query selecting a
field therefore reported a single value regardless of how many matched.
Compare the FieldValue as well, and add a regression covering distinct
values, equal indexes and a narrower projection contained in a wider one.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The pushType field (593e59e0) lets the DHT proxy server tag push
notifications with the connection type ("pt" in the FCM payload), so
mobile clients can tell incoming calls apart from background noise.
It was only serialized in msgpack. Clients using DhtProxyClient
send their puts as JSON (Value::toJson()), where the field was
silently dropped, and the proxy server parsed the incoming JSON with
Value(const Json::Value&), which never read it back. As a result any
value put through a proxy (e.g. a call request from a mobile device)
reached the recipient's device with an empty "pt", was classified as
noise, and did not wake up the callee: calls from proxied devices
never rang, while the same call from a full DHT node (desktop) did.
Serialize pushType as "pt" in Value::toJson() when set, and parse it
back in the JSON constructor, mirroring the msgpack behavior.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Based on Windows build adjustment code from @novemus
(see his magnificient code merge request #716)
- Determined full-static and dynamic link libraries for
Windows if built using MSYS2 or MSVC
- Built without restinio and llhttp [TODO]
- Set for automatic fetching and population from the network
the following libraries for MSYS2:
- GnuTLS 3.8.4 for 64-bit Windows (tested for dynamic
and static builds)
- Auto name adjustments for GnuTLS
- GnuTLS 3.8.9 for 32-bit Windows (untested)
- cJSON as a dependency for msgpack
- msgpack 6.1.1
- jsoncpp 1.9.5
- libfmt 11.1.2
- libasio 1.30.2
for MSVC:
- cJSON (used by msgpack in dynamic builds)
- jsoncpp 1.9.5
- libfmt 11.1.2
- Various build scenario fixes for MSVC dynamic builds
- Added modular codebase for infohash.cpp to avoid header
treatment mismatches in MSVC when compiling DLL
- Added convenience prints in the build scenario
- Fixed inconvenient usage of pkgconfig in Windows, the
link scenarios adjusted accordingly
- Fixed hardcoded find_library calls
- Added standard CMake handler for Boost library using
BOOST_ROOT variable, including environmental definition
- Fixed libreadline linkage on POSIX when the default link
point is turned off for OPENDHT_TOOLS (Mint Linux)
- Added versioned handler for CMP0167 policy (from CMake 3.30)
- Code fixes for compatibility headers in Windows (crypto.cpp,
network_utils.h, utils.h)
- Urgent fix for improper redefinition of _WINNT_VERSION for
Windows 10/11
(https://github.com/savoirfairelinux/opendht/pull/716#issuecomment-2793129052)
- Compile definitions fixed for opendht_EXPORTS and OPENDHT_BUILD
in build scenario for OPENDHT_TOOLS
- Urgent fix for GnuTLS version handler in the code (type
redefinition in version 3.8.7 and later)
https://github.com/savoirfairelinux/opendht/pull/716#issuecomment-2792592951
- Various fixes for proper dynamic linking in Windows
- Built and tested in dynamic and static build scenarios under
MSYS2 in Windows 10 and Windows 11, proven working. The
static build does not seem fully static, the redevelopment
of the MSVC build scenario is proposed by @novemus
- Built and tested in static mode under MSVC/Visual Studio 2022.
Proven working
- Improper usage of the C's free() function is detected in GnuTLS
dynamically linked in Windows (shiftmedia-gnutls 3.7.2 to 3.8.7)
- Added a MSVC-specific source hack to avoid using gnutls_free()
function when built in Windows using dynamic link.
!!! CAUTION !!!
This implementation should be considered as a dirty hack likely
leading to memory leaks! The code should be thoroughly tested
and refactored to avoid memory leaks, but the true origin of
errors is still not revealed [TODO]
- My respect to @novemus and his works over #716
All encrypted values put on the DHT currently have the default priority
of 0 because the priority information is ignored by the Value::encrypt
function.