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

Commit 284bd474 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Rootcanal catch SIGPIPE"

parents d5955b12 8c208f5d
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));
      }