Skip to content

Commit

Permalink
fix(mdns): Rust experimenatation
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cermak committed Nov 18, 2024
1 parent 73c4830 commit b4ed1f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/mdns/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
set(dependencies esp_netif_linux esp_event)
set(private_dependencies esp_timer console esp_system)
set(srcs "mdns.c" ${MDNS_NETWORKING} ${MDNS_CONSOLE})
set(srcs ${MDNS_NETWORKING} ${MDNS_CONSOLE})
else()
set(dependencies lwip console esp_netif)
set(private_dependencies esp_timer esp_wifi)
Expand Down
9 changes: 7 additions & 2 deletions components/mdns/mdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static inline esp_netif_t *esp_netif_from_preset_if(mdns_predef_if_t predef_if)
* @param tcpip_if Ordinal number of the interface
* @return Pointer ot the esp_netif object if the interface is available, NULL otherwise
*/
esp_netif_t *_mdns_get_esp_netif(mdns_if_t tcpip_if)
esp_netif_t *_mdns_get_esp_netif23(mdns_if_t tcpip_if)
{
if (tcpip_if < MDNS_MAX_INTERFACES) {
if (s_esp_netifs[tcpip_if].netif == NULL && s_esp_netifs[tcpip_if].predefined) {
Expand Down Expand Up @@ -347,7 +347,7 @@ static bool _mdns_can_add_more_services(void)
return true;
}

esp_err_t _mdns_send_rx_action(mdns_rx_packet_t *packet)
esp_err_t _mdns_send_rx_action23(mdns_rx_packet_t *packet)
{
mdns_action_t *action = NULL;

Expand Down Expand Up @@ -1544,6 +1544,11 @@ static void _mdns_dispatch_tx_packet(mdns_tx_packet_t *p)
mdns_debug_packet(packet, index);
#endif

ESP_LOG_BUFFER_HEXDUMP(TAG, packet, index, ESP_LOG_INFO);
for (int i = 0; i < index; ++i) {
printf("0x%02x, ", packet[i]);
}
printf("\n");
_mdns_udp_pcb_write(p->tcpip_if, p->ip_protocol, &p->dst, p->port, packet, index);
}

Expand Down
2 changes: 1 addition & 1 deletion components/mdns/mdns_networking_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ size_t _mdns_udp_pcb_write(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol, c
ESP_LOGE(TAG, "espaddr_to_inet() failed: Mismatch of IP protocols");
return 0;
}
ESP_LOGD(TAG, "[sock=%d]: Sending to IP %s port %d", sock, get_string_address(&in_addr), port);
ESP_LOGI(TAG, "[sock=%d]: Sending to IP %s port %d", sock, get_string_address(&in_addr), port);
ssize_t actual_len = sendto(sock, data, len, 0, (struct sockaddr *)&in_addr, ss_size);
if (actual_len < 0) {
ESP_LOGE(TAG, "[sock=%d]: _mdns_udp_pcb_write sendto() has failed\n errno=%d: %s", sock, errno, strerror(errno));
Expand Down

0 comments on commit b4ed1f4

Please sign in to comment.