Skip to content

Commit

Permalink
Fixed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Apr 1, 2021
1 parent 2b6aff8 commit b089738
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions src/net/zephyr/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@
#include "zenoh-pico/private/logging.h"
#include "zenoh-pico/private/iobuf.h"

typedef struct {
struct net_if * iface;
typedef struct
{
struct net_if *iface;
} iface_info_t;

void net_if_iterator_func(struct net_if *iface, void *user_data)
{
iface_info_t * iface_info = user_data;
iface_info_t *iface_info = user_data;

if (iface_info->iface == NULL)
{
iface_info->iface = iface;
}

}

/*------------------ Interfaces and sockets ------------------*/
Expand All @@ -60,12 +60,12 @@ char *_zn_select_scout_iface()
if (iface_info.iface != NULL)
{
struct net_addr addr = iface_info.iface->config.ip.ipv4->unicast->address;
struct sockaddr_in sa = { .sin_family = addr.family, .sin_addr = addr.in_addr };
struct sockaddr_in sa = {.sin_family = addr.family, .sin_addr = addr.in_addr};

getnameinfo((const struct sockaddr*)&sa,
sizeof(struct sockaddr_in),
host, NI_MAXHOST,
NULL, 0, NI_NUMERICHOST);
getnameinfo((const struct sockaddr *)&sa,
sizeof(struct sockaddr_in),
host, NI_MAXHOST,
NULL, 0, NI_NUMERICHOST);
_Z_DEBUG_VA("\t-- Interface: %s\tAddress: <%s>\n", current->ifa_name, host);

char *result = strdup(host);
Expand Down Expand Up @@ -141,17 +141,7 @@ _zn_socket_result_t _zn_create_udp_socket(const char *addr, int port, int timeou
return r;
}

// NOTE(esteve): SO_SNDTIMEO not supported in Zephyr
/*
if (setsockopt(r.value.socket, SOL_SOCKET, SO_SNDTIMEO, (void *)&timeout, sizeof(struct timeval)) == -1)
{
r.tag = _z_res_t_ERR;
r.value.error = errno;
close(r.value.socket);
r.value.socket = 0;
return r;
}
*/
// NOTE: SO_SNDTIMEO socket option is not supported in Zephyr
return r;
}

Expand Down Expand Up @@ -202,7 +192,7 @@ _zn_socket_result_t _zn_open_tx_session(const char *locator)
return r;
}

// NOTE(esteve): SO_KEEPALIVE and SO_LINGER not supported in Zephyr
// NOTE: SO_KEEPALIVE and SO_LINGER socket options are not supported in Zephyr

memset(&serv_addr, 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
Expand Down Expand Up @@ -312,3 +302,5 @@ int _zn_send_wbuf(_zn_socket_t sock, const _z_wbuf_t *wbf)

return 0;
}

// NOTE: iovec operations are not supported in Zephyr

0 comments on commit b089738

Please sign in to comment.