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

Commit ab206a06 authored by Hansong Zhang's avatar Hansong Zhang Committed by android-build-merger
Browse files

Merge "Rootcanal: add error string for debugging"

am: 552a93b7

Change-Id: I11e91b883aa3557111806c803f83352ed757468b
parents a58075ca 552a93b7
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include "osi/include/log.h"
#include "osi/include/osi.h"

#include <errno.h>
#include <netinet/in.h>
#include <sys/socket.h>

@@ -44,7 +45,7 @@ int TestChannelTransport::SetUp(int port) {
  int enable = 1;
  if (setsockopt(
      listen_fd_, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)) < 0) {
    LOG_ERROR(LOG_TAG, "setsockopt(SO_REUSEADDR) failed");
    LOG_ERROR(LOG_TAG, "setsockopt(SO_REUSEADDR) failed: %s", strerror(errno));
  }

  LOG_INFO(LOG_TAG, "port: %d", port);
@@ -53,13 +54,15 @@ int TestChannelTransport::SetUp(int port) {
  listen_address.sin_addr.s_addr = htonl(INADDR_ANY);

  if (bind(listen_fd_, reinterpret_cast<sockaddr*>(&listen_address), sockaddr_in_size) < 0) {
    LOG_INFO(LOG_TAG, "Error binding test channel listener socket to address.");
    LOG_INFO(LOG_TAG,
             "Error binding test channel listener socket to address: %s",
             strerror(errno));
    close(listen_fd_);
    return -1;
  }

  if (listen(listen_fd_, 1) < 0) {
    LOG_INFO(LOG_TAG, "Error listening for test channel.");
    LOG_INFO(LOG_TAG, "Error listening for test channel: %s", strerror(errno));
    close(listen_fd_);
    return -1;
  }