11 Commits
Author SHA1 Message Date
Andrés Felipe Méndez 4eb339156b fix crash add test, add worker thread (#192)
* fix crash add test, add worker thread

* Improve HTTP/WS cleanup and test timing

Resolves cleanup/race issues and speeds up integration tests:

- impl/httpCurl/NHttpClientLibCurl.cpp: Remove curl handle earlier and deduplicate calls to curl_multi_remove_handle(), logging errors immediately if removal fails to avoid double-remove races.
- impl/wsWslay/NWebsocketWslay.cpp: Avoid heap allocation for received message by capturing a moved stack NBytes in the callback; ensure destructor always stops IO, joins the thread and cleans up the connection to prevent lingering IO.
- integrationtests/src/NTest.cpp: Run deleteAccountAsync calls concurrently and pump only the HTTP client while waiting to avoid RT client races; consume results best-effort. Also reduce tick/check timeouts from 50ms to 5ms to speed test loops.

* pr comments

* Add exception destructors and Android test updates

Provide out-of-line destructor definitions for NException and NRtException and declare their destructors in headers to satisfy the ABI and avoid inline dtor issues.

Revamp Android integration test setup: add gradle.properties and .gitignore entries, switch build.gradle to use prebuilt native libraries staged under jniLibs (avoid Gradle/CMake integration conflicts), add usesCleartextTraffic to AndroidManifest, and update integration main to run tests with client/rt client factories and server params. The deploy.sh script was rewritten to support building native libs via CMake presets, staging .so and libc++_shared, assembling the APK, installing to a device/emulator, setting up adb reverse, streaming logcat and parsing test results. Also increase tournament test durations to 60s to be more tolerant of slow environments (e.g. emulators).

* Refactor test cleanup, logging and Taskfile

Multiple changes to improve test reliability and logging behavior:

- integrationtests/src/NTest.cpp: Use a detached cleanup thread to pump the HTTP client with a 10s timeout, wait/join or detach based on completion, and avoid hangs when tick() blocks. Added <future> and best-effort future get handling; emit warning if cleanup times out.
- impl/httpLibHttpClient/NHttpClientLibHC.cpp and impl/wsLibHttpClient/NWebsocketLibHC.cpp: Map NLogLevel::Debug to HCTraceLevel::Warning (was Verbose) to adjust trace level mapping.
- Taskfile.yml: Only apply Xcode code-signing overrides on macOS, add docker compose --wait to service startup in multiple tasks, make the test task start the server automatically and copy built .dlls into the integrationtests folder (best-effort) so tests can find native binaries.
- interface headers: add <stdexcept> includes in NException.h and realtime/rtdata/NRtException.h to ensure exception types are available.

These changes aim to prevent test hangs during shutdown, ensure dependent services are ready before tests run, and fix missing includes and logging-level mapping.

* Add cancellation and retry integration tests

Introduce integrationtests/src/test_cancellation.cpp with a suite of tests covering request cancellation, disconnect recovery, and retry/idempotency scenarios (cancel_noPendingRequests, cancel_inflightRequests, cancel_recoveryAfterDisconnect, retry_afterConnectionError, retry_afterUnauthenticated, retry_afterSessionExpiry, retry_storageIdempotent, retry_authAndGetAccount). Also update integrationtests/src/NTestLib.cpp to declare and run test_cancellation so the new tests are included in the test run. These tests improve coverage around client disconnect behavior, CancelledByUser handling, and recovery/retry patterns.

* Add configure status; recreate XTaskQueue

NHttpClientLibHC.cpp: ensure m_queue_terminated is reset before terminating, then recreate the XTaskQueue after XTaskQueueTerminate so the client can be reused after cancellation; log an error if queue creation fails.

* Make Android deploy script cross-platform

Taskfile: loosened tests-android invocation (DEVICE is optional, ABI default kept) and delegate build/deploy to integrationtests/android/deploy.sh with an --abi flag.

deploy.sh: added OS detection and portability fixes (Windows/macOS/Linux), auto-detect ANDROID_HOME (including LOCALAPPDATA on Windows) and normalize backslashes, prefer adb from PATH with fallback to ANDROID_HOME, auto-detect/suggest JDK 17 and set JAVA_HOME if found, and normalize ANDROID_NDK_HOME. Build now runs from repo root (pushd/popd) and uses HOST_OS for NDK STL path. All adb calls now go through a resolved ADB variable. These changes improve robustness and cross-platform support for Android integration tests.

* linux build

* inline deploy.sh

* rename

* run android tests windows

* dis own proces on powershell

* ensure exported interfaces have out-of-line key functions avoiding linker RTTI issues

* revert to private wslay

* change to 10 ms
2026-03-05 13:51:41 -05:00
Ricard Rovira Cubeles 828447ba6e Update milliseconds comparison 2025-07-17 21:21:48 +01:00
Ricard Rovira Cubeles a59565e3f9 Add default format and apply (#167)
* Add default format
* Apply format to all code
2025-07-17 21:21:48 +01:00
cddc647ce7 Timeout implementation (#163)
Add ability to set timeouts to the rest api (milliseconds for the backends that support that much granularity, seconds for the ones that do not).
---------

Co-authored-by: Maxim Ivanov <[email protected]>
Co-authored-by: Maxim Ivanov <[email protected]>
2025-07-17 21:21:48 +01:00
Maxim Ivanov 7279be6f9f libhttpclient build fixes 2025-07-17 21:21:48 +01:00
Maxim Ivanov ba7a28e187 NDAed platforms build refactor 2025-07-17 21:21:48 +01:00
Luke 49595bd4b3 Android Libcurl (#99) 2023-02-14 08:56:53 -05:00
Luke 7dc6765307 x86 support and set appropriate libhttpclient for windows, gdk, xdk (#90) 2023-01-10 10:13:33 -05:00
Luke d0a67e06cf Make changes necessary for cocos2d support, more flexible dependency management 2022-12-19 14:36:43 -05:00
Luke 1f2298232e Allow vcpkg features to be fed to the cmake build system (#85) 2022-11-04 11:47:32 -04:00
Luke c091bca049 Upgraded build system, better platform support and dependency management (#60) 2022-09-08 10:34:53 -04:00