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

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

Merge "Rootcanal catch SIGPIPE"

am: 284bd474

Change-Id: I35ef9468b76626fbc44e16b985f5e21bad991a42
parents 07d7f52e 284bd474
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>

@@ -48,6 +49,11 @@ void TestEnvironment::initialize(std::promise<void> barrier) {
  SetUpHciServer([this](int fd) { test_model_.IncomingHciConnection(fd); });
  SetUpLinkLayerServer([this](int fd) { test_model_.IncomingLinkLayerConnection(fd); });

  // In case the client socket is closed, and rootcanal doesn't detect it due to
  // TimerTick not fired, writing to the socket causes a SIGPIPE and we need to
  // catch it to prevent rootcanal from crash
  signal(SIGPIPE, SIG_IGN);

  LOG_INFO("%s: Finished", __func__);
}

+3 −0
Original line number Diff line number Diff line
@@ -105,6 +105,9 @@ void H4Packetizer::OnDataReady(int fd) {
      if (errno == EAGAIN) {
        // No data, try again later.
        return;
      } else if (errno == ECONNRESET) {
        // They probably rejected our packet
        return;
      } else {
        LOG_ALWAYS_FATAL("%s: Read packet type error: %s", __func__, strerror(errno));
      }