-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Small compatibility improvements for esp32 embedded platforms #741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,9 @@ | |
#endif | ||
|
||
# include <netinet/in.h> | ||
#ifdef HAVE_NETINET_IP_H | ||
# include <netinet/ip.h> | ||
#endif | ||
# include <netinet/tcp.h> | ||
# include <arpa/inet.h> | ||
# include <netdb.h> | ||
|
@@ -401,7 +403,11 @@ static int _modbus_tcp_pi_connect(modbus_t *ctx) | |
rc = getaddrinfo(ctx_tcp_pi->node, ctx_tcp_pi->service, &ai_hints, &ai_list); | ||
if (rc != 0) { | ||
if (ctx->debug) { | ||
#ifdef HAVE_GAI_STRERROR | ||
fprintf(stderr, "Error returned by getaddrinfo: %s\n", gai_strerror(rc)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why use gai_strerror and not strerror? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good question ;) But my MR was only to make it conditional (since in ESP-IDF libs there isn't) not to really change the function used. But in case @stephane could consider that! (and then my change would not be needed indeed) |
||
#else | ||
fprintf(stderr, "Error returned by getaddrinfo: %d\n", rc); | ||
#endif | ||
} | ||
freeaddrinfo(ai_list); | ||
errno = ECONNREFUSED; | ||
|
@@ -627,7 +633,11 @@ int modbus_tcp_pi_listen(modbus_t *ctx, int nb_connection) | |
rc = getaddrinfo(node, service, &ai_hints, &ai_list); | ||
if (rc != 0) { | ||
if (ctx->debug) { | ||
#ifdef HAVE_GAI_STRERROR | ||
fprintf(stderr, "Error returned by getaddrinfo: %s\n", gai_strerror(rc)); | ||
#else | ||
fprintf(stderr, "Error returned by getaddrinfo: %d\n", rc); | ||
#endif | ||
} | ||
freeaddrinfo(ai_list); | ||
errno = ECONNREFUSED; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ip.h
providesIPTOS_LOWDELAY
so how this setting is available on ESP32?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in
lwip/sockets.h
which comes fromnetdb.h
(above)