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

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

Merge "Rootcanal catch SIGPIPE" am: 284bd474 am: 1680afd0

am: fd416389

Change-Id: I1a4492d453e63e83a22e25f31a212d319f5b2eb1
parents 803c0f14 fd416389
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));
      }