mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 21:44:55 +01:00
Create IPv4 sockets if ipv6 is not enabled (#5565)
This commit is contained in:
parent
a8667b680e
commit
b7402ee6ff
1 changed files with 3 additions and 3 deletions
|
@ -10,7 +10,7 @@ namespace socket {
|
||||||
Socket::~Socket() {}
|
Socket::~Socket() {}
|
||||||
|
|
||||||
std::unique_ptr<Socket> socket_ip(int type, int protocol) {
|
std::unique_ptr<Socket> socket_ip(int type, int protocol) {
|
||||||
#if LWIP_IPV6
|
#if ENABLE_IPV6
|
||||||
return socket(AF_INET6, type, protocol);
|
return socket(AF_INET6, type, protocol);
|
||||||
#else
|
#else
|
||||||
return socket(AF_INET, type, protocol);
|
return socket(AF_INET, type, protocol);
|
||||||
|
@ -18,7 +18,7 @@ std::unique_ptr<Socket> socket_ip(int type, int protocol) {
|
||||||
}
|
}
|
||||||
|
|
||||||
socklen_t set_sockaddr(struct sockaddr *addr, socklen_t addrlen, const std::string &ip_address, uint16_t port) {
|
socklen_t set_sockaddr(struct sockaddr *addr, socklen_t addrlen, const std::string &ip_address, uint16_t port) {
|
||||||
#if LWIP_IPV6
|
#if ENABLE_IPV6
|
||||||
if (addrlen < sizeof(sockaddr_in6)) {
|
if (addrlen < sizeof(sockaddr_in6)) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -51,7 +51,7 @@ socklen_t set_sockaddr(struct sockaddr *addr, socklen_t addrlen, const std::stri
|
||||||
}
|
}
|
||||||
|
|
||||||
socklen_t set_sockaddr_any(struct sockaddr *addr, socklen_t addrlen, uint16_t port) {
|
socklen_t set_sockaddr_any(struct sockaddr *addr, socklen_t addrlen, uint16_t port) {
|
||||||
#if LWIP_IPV6
|
#if ENABLE_IPV6
|
||||||
if (addrlen < sizeof(sockaddr_in6)) {
|
if (addrlen < sizeof(sockaddr_in6)) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue