Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 845cdf20 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix small socket config issues."

parents cac2879e 1170803a
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -38,7 +38,11 @@ namespace net {
PosixAsyncSocket::PosixAsyncSocket(int fd, AsyncManager* am)
    : fd_(fd), am_(am), watching_(false) {
  int flags = fcntl(fd, F_GETFL);
  fcntl(fd, F_SETFL, flags | O_NONBLOCK | FD_CLOEXEC);
  fcntl(fd, F_SETFL, flags | O_NONBLOCK);

  flags = fcntl(fd, F_GETFD);
  fcntl(fd, F_SETFD, flags | O_CLOEXEC);

#ifdef SO_NOSIGPIPE
  // Disable SIGPIPE generation on Darwin.
  // When writing to a broken pipe, send() will return -1 and
+8 −7
Original line number Diff line number Diff line
@@ -14,14 +14,14 @@
// limitations under the License.
#include "net/posix/posix_async_socket_connector.h"

#include <arpa/inet.h>   // for inet_addr, inet_ntoa
#include <errno.h>       // for errno, EAGAIN, EINPROGRESS
#include <fcntl.h>       // for fcntl, F_GETFL, F_SETFL
#include <netdb.h>       // for gethostbyname
#include <netinet/in.h>  // for sockaddr_in, INADDR_ANY
#include <netdb.h>       // for gethostbyname, addrinfo
#include <netinet/in.h>  // for sockaddr_in, in_addr
#include <poll.h>        // for poll, POLLHUP, POLLIN, POL...
#include <string.h>      // for strerror, memset, NULL
#include <sys/socket.h>  // for connect, getsockopt, socket
#include <unistd.h>      // for close
#include <string.h>      // for strerror, NULL
#include <sys/socket.h>  // for connect, getpeername, gets...
#include <type_traits>   // for remove_extent_t

#include "net/posix/posix_async_socket.h"  // for PosixAsyncSocket
#include "os/log.h"                        // for LOG_INFO
@@ -57,9 +57,10 @@ PosixAsyncSocketConnector::ConnectToRemoteServer(
    return pas;
  }

  struct in_addr** addr_list = (struct in_addr**)host->h_addr_list;
  struct sockaddr_in serv_addr {};
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_addr.s_addr = INADDR_ANY;
  serv_addr.sin_addr.s_addr = inet_addr(inet_ntoa(*addr_list[0]));
  serv_addr.sin_port = htons(port);

  int result =