Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/common/eebus_malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define SRC_COMMON_EEBUS_MALLOC_H_

#if defined(__freertos__)
#include <FreeRTOS.h>
#include <freertos/FreeRTOS.h>

#define EEBUS_MALLOC(size) pvPortMalloc((size))
#define EEBUS_FREE(size) vPortFree((size))
Expand Down
1 change: 0 additions & 1 deletion src/ship/mdns/ship_mdns_bonjour.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
#include "src/common/vector.h"
#include "src/ship/api/mdns_entry.h"
#include "src/ship/api/ship_mdns_interface.h"
#include "src/ship/ship_connection/types.h"

/** Set MDNS_DEBUG 1 to enable debug prints */
#ifndef MDNS_DEBUG
Expand Down
18 changes: 16 additions & 2 deletions src/ship/mdns/ship_mdns_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ static void Stop(ShipMdnsObject* self);
static EebusError RegisterService(ShipMdnsObject* self);
static void DeregisterService(ShipMdnsObject* self);
static void SetAutoaccept(ShipMdnsObject* self, bool autoaccept);
static void MdnsNotifyFoundEntries(Mdns* mdns);

static const ShipMdnsInterface mdns_methods = {
.destruct = Destruct,
Expand Down Expand Up @@ -217,6 +218,20 @@ void MdnsQueryNotifyCallback(mdns_search_once_t* search) {
xSemaphoreGive(mdns->semaphore);
}

static void MdnsNotifyFoundEntries(Mdns* mdns) {
const size_t found_count = VectorGetSize(mdns->found_entries);
Vector* const copy = VectorCreateWithDeallocator(MdnsEntryDeallocator);

for (size_t i = 0; i < found_count; ++i) {
MdnsEntry* const entry = (MdnsEntry*)VectorGetElement(mdns->found_entries, i);
if (entry != NULL) {
VectorPushBack(copy, MdnsEntryCopy(entry));
}
}

mdns->on_entries_found_cb(copy, mdns->context);
}

void MdnsProcessSearchResult(Mdns* mdns, mdns_search_once_t* search) {
mdns_result_t* results = NULL;

Expand Down Expand Up @@ -251,8 +266,7 @@ void MdnsProcessSearchResult(Mdns* mdns, mdns_search_once_t* search) {
}

mdns_query_results_free(results);

mdns->on_entries_found_cb(mdns->found_entries, mdns->context);
MdnsNotifyFoundEntries(mdns);
}

uint32_t GetUpdateIntervalMs(void) {
Expand Down
Loading