Skip to content

Commit ff69c6f

Browse files
committed
fix(mdns): Revert test cleanup mdns sender
This reverts commit 5c2c597.
1 parent 5c2c597 commit ff69c6f

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

components/mdns/mdns_send.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,12 @@ static uint8_t append_reverse_ptr_record(uint8_t *packet, uint16_t *index, const
491491
return 0;
492492
}
493493

494-
if (!append_type(packet, index, MDNS_ANSWER_PTR, false, 10 /* TTL set to 10s*/)) {
494+
if (!_mdns_append_type(packet, index, MDNS_ANSWER_PTR, false, 10 /* TTL set to 10s*/)) {
495495
return 0;
496496
}
497497

498498
uint16_t data_len_location = *index - 2; /* store the position of size (2=16bis) of this record */
499-
const char *str[2] = {mdns_priv_get_self_host()->hostname, MDNS_UTILS_DEFAULT_DOMAIN };
499+
const char *str[2] = {priv_get_self_host()->hostname, MDNS_UTILS_DEFAULT_DOMAIN };
500500

501501
int part_length = append_fqdn(packet, index, str, 2, MDNS_MAX_PACKET_SIZE);
502502
if (!part_length) {
@@ -588,7 +588,8 @@ void mdns_priv_create_answer_from_parsed_packet(mdns_parsed_packet_t *parsed_pac
588588
#ifdef CONFIG_MDNS_RESPOND_REVERSE_QUERIES
589589
} else if (q->type == MDNS_TYPE_PTR) {
590590
mdns_host_item_t *host = get_host_item(q->host);
591-
if (!mdns_priv_create_answer(&packet->answers, MDNS_TYPE_PTR, NULL, host, send_flush, false)) {
591+
#error
592+
if (!_mdns_alloc_answer(&packet->answers, MDNS_TYPE_PTR, NULL, host, send_flush, false)) {
592593
mdns_priv_free_tx_packet(packet);
593594
return;
594595
} else {

components/mdns/tests/host_unit_test/stubs/mdns_engine.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static void execute_action(mdns_action_t *action)
2929
break;
3030

3131
case ACTION_TX_HANDLE:
32-
mdns_priv_send_action(action, ACTION_RUN);
32+
mdns_send_action(action, ACTION_RUN);
3333
break;
3434
case ACTION_RX_HANDLE:
3535
mdns_priv_receive_action(action, ACTION_RUN);

components/mdns/tests/host_unit_test/unity/test_receiver/test_receiver.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ void setup_cmock(void)
7474
mdns_priv_pcb_check_probing_services_CMockIgnore();
7575
mdns_priv_pcb_is_after_probing_IgnoreAndReturn(true);
7676

77-
mdns_priv_clear_tx_queue_CMockIgnore();
78-
mdns_priv_remove_scheduled_service_packets_CMockIgnore();
77+
_mdns_clear_tx_queue_head_CMockIgnore();
78+
_mdns_remove_scheduled_service_packets_CMockIgnore();
7979
mdns_priv_create_answer_from_parsed_packet_Stub(mdns_priv_create_answer_from_parsed_packet_Callback);
8080
}
8181

components/mdns/tests/host_unit_test/unity/test_sender/test_sender.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ void setup_cmock(void)
1818
mdns_priv_pcb_is_after_probing_IgnoreAndReturn(true);
1919
}
2020

21+
22+
23+
// Example of a more complex test with answers and additional records
2124
static void test_dispatch_tx_packet(void)
2225
{
2326
mdns_tx_packet_t p = {};
24-
mdns_priv_dispatch_tx_packet(&p);
27+
_mdns_dispatch_tx_packet(&p);
2528
}
2629

30+
2731
void run_unity_tests(void)
2832
{
2933
UNITY_BEGIN();

0 commit comments

Comments
 (0)