Skip to content

Commit

Permalink
msgr: stop accepter on socket error
Browse files Browse the repository at this point in the history
Only if we get a few in a row.
  • Loading branch information
liewegas committed Dec 17, 2008
1 parent 82b0bc3 commit ba140b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/msg/SimpleMessenger.cc
Expand Up @@ -208,6 +208,7 @@ void *Rank::Accepter::entry()
dout(10) << "accepter starting" << dendl;

fd_set fds;
int errors = 0;
while (!done) {
FD_ZERO(&fds);
FD_SET(listen_sd, &fds);
Expand All @@ -222,6 +223,7 @@ void *Rank::Accepter::entry()
socklen_t slen = sizeof(addr);
int sd = ::accept(listen_sd, (sockaddr*)&addr, &slen);
if (sd >= 0) {
errors = 0;
opened_socket();
dout(10) << "accepted incoming on sd " << sd << dendl;

Expand All @@ -242,7 +244,9 @@ void *Rank::Accepter::entry()
}
rank.lock.Unlock();
} else {
dout(10) << "accepter no incoming connection? sd = " << sd << " errno " << errno << " " << strerror(errno) << dendl;
dout(0) << "accepter no incoming connection? sd = " << sd << " errno " << errno << " " << strerror(errno) << dendl;
if (++errors > 4)
break;
}
}

Expand Down

0 comments on commit ba140b5

Please sign in to comment.