Skip to content

Commit

Permalink
Ignore SIGPIPE
Browse files Browse the repository at this point in the history
Change-Id: I25ab74c2637bb4cc8ba2666cd0170f3dd29b3ca4
  • Loading branch information
litao.sre committed Feb 23, 2019
1 parent 152812c commit 4312f3b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/server.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "server.h"

#include <signal.h>

#include "glog/logging.h"
#include "net.h"

Expand All @@ -11,6 +13,10 @@ Server::~Server() {
}

bool Server::Init() {
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
LOG(ERROR) << "ignore SIGPIPE error: " << strerror(errno);
return false;
}
int needed_fds = max_connections_ + 1024;
if (!SetRlimitNofile(needed_fds)) {
return false;
Expand Down

0 comments on commit 4312f3b

Please sign in to comment.