Skip to content

Commit 6e21727

Browse files
authored
Merge branch 'main' into bhamehta/fix-lowsev-hardening
2 parents 0670fde + fb500b0 commit 6e21727

5 files changed

Lines changed: 32 additions & 17 deletions

File tree

‎lib/api/capi.cpp‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ capi_client * MAT::capi_get_client(evt_handle_t handle)
4949
/// <summary>
5050
/// Remove C API handle from active client tracking struct.
5151
/// </summary>
52-
void remove_client(evt_handle_t handle)
52+
static void remove_client(evt_handle_t handle)
5353
{
5454
LOCKGUARD(mtx);
5555
clients.erase(handle);
@@ -66,7 +66,7 @@ void remove_client(evt_handle_t handle)
6666
return ENOENT; \
6767
};
6868

69-
evt_status_t mat_open_core(
69+
static evt_status_t mat_open_core(
7070
evt_context_t *ctx,
7171
const char* config,
7272
http_send_fn_t httpSendFn,
@@ -175,7 +175,7 @@ evt_status_t mat_open_core(
175175
return ctx->result;
176176
}
177177

178-
evt_status_t mat_open(evt_context_t *ctx)
178+
static evt_status_t mat_open(evt_context_t *ctx)
179179
{
180180
if (ctx == nullptr)
181181
{
@@ -186,7 +186,7 @@ evt_status_t mat_open(evt_context_t *ctx)
186186
return mat_open_core(ctx, config, nullptr, nullptr, nullptr, nullptr, nullptr);
187187
}
188188

189-
evt_status_t mat_open_with_params(evt_context_t *ctx)
189+
static evt_status_t mat_open_with_params(evt_context_t *ctx)
190190
{
191191
if (ctx == nullptr)
192192
{
@@ -231,9 +231,9 @@ evt_status_t mat_open_with_params(evt_context_t *ctx)
231231
}
232232

233233
/**
234-
* Marashal C struct to C++ API
234+
* Marshal C struct to C++ API
235235
*/
236-
evt_status_t mat_log(evt_context_t *ctx)
236+
static evt_status_t mat_log(evt_context_t *ctx)
237237
{
238238
VERIFY_CLIENT_HANDLE(client, ctx);
239239

@@ -285,7 +285,7 @@ evt_status_t mat_log(evt_context_t *ctx)
285285
return ctx->result;
286286
}
287287

288-
evt_status_t mat_close(evt_context_t *ctx)
288+
static evt_status_t mat_close(evt_context_t *ctx)
289289
{
290290
VERIFY_CLIENT_HANDLE(client, ctx);
291291
const auto result = static_cast<evt_status_t>(LogManagerProvider::Release(client->logmanager->GetLogConfiguration()));
@@ -305,31 +305,31 @@ evt_status_t mat_close(evt_context_t *ctx)
305305
return result;
306306
}
307307

308-
evt_status_t mat_pause(evt_context_t *ctx)
308+
static evt_status_t mat_pause(evt_context_t *ctx)
309309
{
310310
VERIFY_CLIENT_HANDLE(client, ctx);
311311
const auto result = static_cast<evt_status_t>(client->logmanager->PauseTransmission());
312312
ctx->result = result;
313313
return result;
314314
}
315315

316-
evt_status_t mat_resume(evt_context_t *ctx)
316+
static evt_status_t mat_resume(evt_context_t *ctx)
317317
{
318318
VERIFY_CLIENT_HANDLE(client, ctx);
319319
const auto result = static_cast<evt_status_t>(client->logmanager->ResumeTransmission());
320320
ctx->result = result;
321321
return result;
322322
}
323323

324-
evt_status_t mat_upload(evt_context_t *ctx)
324+
static evt_status_t mat_upload(evt_context_t *ctx)
325325
{
326326
VERIFY_CLIENT_HANDLE(client, ctx);
327327
const auto result = static_cast<evt_status_t>(client->logmanager->UploadNow());
328328
ctx->result = result;
329329
return result;
330330
}
331331

332-
evt_status_t mat_flushAndTeardown(evt_context_t *ctx)
332+
static evt_status_t mat_flushAndTeardown(evt_context_t *ctx)
333333
{
334334
VERIFY_CLIENT_HANDLE(client, ctx);
335335
client->logmanager->FlushAndTeardown();

‎lib/offline/MemoryStorage.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
namespace MAT_NS_BEGIN {
2626

27-
class MemoryStorage : public IOfflineStorage
27+
class MemoryStorage final : public IOfflineStorage
2828
{
2929

3030
public:
@@ -69,7 +69,7 @@ namespace MAT_NS_BEGIN {
6969

7070
virtual size_t GetRemainingRecordCountForShutdown() const override;
7171

72-
virtual size_t GetReservedCount();
72+
size_t GetReservedCount();
7373

7474
virtual std::vector<StorageRecord> GetRecords(bool shutdown = false, EventLatency minLatency = EventLatency_Unspecified, unsigned maxCount = 0) override;
7575

‎lib/offline/OfflineStorageHandler.hpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace MAT_NS_BEGIN {
2525

26-
class OfflineStorageHandler : public IOfflineStorage, public IOfflineStorageObserver
26+
class OfflineStorageHandler final : public IOfflineStorage, public IOfflineStorageObserver
2727
{
2828
public:
2929
OfflineStorageHandler(ILogManager& logManager, IRuntimeConfig& runtimeConfig, ITaskDispatcher& taskDispatcher);
@@ -64,7 +64,7 @@ namespace MAT_NS_BEGIN {
6464
virtual void OnStorageRecordsSaved(size_t numRecords) override;
6565

6666
protected:
67-
virtual void DeleteRecordsByKeys(const std::list<std::string> & keys);
67+
void DeleteRecordsByKeys(const std::list<std::string> & keys);
6868

6969
IOfflineStorageObserver * m_observer;
7070
ILogManager & m_logManager;
@@ -75,7 +75,7 @@ namespace MAT_NS_BEGIN {
7575
KillSwitchManager m_killSwitchManager;
7676
ClockSkewManager m_clockSkewManager;
7777

78-
virtual bool isKilled(StorageRecord const& record);
78+
bool isKilled(StorageRecord const& record);
7979

8080
std::mutex m_flushLock;
8181
bool m_flushPending;

‎lib/shared/dllmain.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifdef _MANAGED
1919
#pragma unmanaged
2020
#endif
21-
unsigned thread_count = 0;
21+
static unsigned thread_count = 0;
2222

2323
BOOL APIENTRY DllMain(HMODULE /* hModule */, DWORD ul_reason_for_call, LPVOID /* lpReserved */)
2424
{

‎tests/functests/MultipleLogManagersTests.cpp‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222

2323
#include "NullObjects.hpp"
2424

25+
#if defined(__APPLE__)
26+
#include <TargetConditionals.h>
27+
#endif
28+
2529
#if defined __has_include && defined(HAVE_MAT_PRIVACYGUARD)
2630
#if __has_include("modules/privacyguard/PrivacyGuard.hpp")
2731
#include "modules/privacyguard/PrivacyGuard.hpp"
@@ -36,6 +40,15 @@
3640
using namespace testing;
3741
using namespace MAT;
3842

43+
// MultipleLogManagersTests stand up an in-process HttpServer on a loopback port
44+
// and run multiple concurrent LogManager instances against it. That pattern
45+
// hangs/fails inside the iOS simulator sandbox (the loopback uploads stall),
46+
// which previously left the iOS CI job to sit until its 60-minute timeout. The
47+
// behavior is still exercised on the desktop and macOS targets; exclude the
48+
// whole suite from the iOS build. (GTEST_SKIP in SetUp is not honored by the
49+
// iOS xctest gtest wrapper, so the exclusion must be at compile time.)
50+
#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE
51+
3952
class RequestHandler : public HttpServer::Callback
4053
{
4154
public:
@@ -292,5 +305,7 @@ TEST_F(MultipleLogManagersTests, PrivacyGuardSharedWithTwoInstancesCoexist)
292305
}
293306
#endif //END HAVE_MAT_PRIVACYGUARD
294307

308+
#endif // !TARGET_OS_IPHONE (suite excluded on iOS; see note above)
309+
295310
#endif // HAVE_MAT_DEFAULT_HTTP_CLIENT
296311

0 commit comments

Comments
 (0)