Permalink
Browse files

ok, so it turns out that poll, select and a few other system calls ca…

…n return EINTR when we receive and interrupt, and we need to manually restart. man 7 signal makes for good reading on this case, as does http://blog.reverberate.org/2011/04/eintr-and-pc-loser-ing-is-better-case.html
  • Loading branch information...
1 parent c63bc74 commit 5dde2c6c91a66846e667e4403f41ee84e53af634 @ahupowerdns ahupowerdns committed with Habbie Dec 16, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 pdns/nameserver.cc
View
@@ -383,9 +383,14 @@ DNSPacket *UDPNameserver::receive(DNSPacket *prefilled)
pfd.revents = 0;
}
+ retry:;
+
err = poll(&rfds[0], rfds.size(), -1);
- if(err < 0)
+ if(err < 0) {
+ if(errno==EINTR)
+ goto retry;
unixDie("Unable to poll for new UDP events");
+ }
BOOST_FOREACH(struct pollfd &pfd, rfds) {
if(pfd.revents & POLLIN) {

0 comments on commit 5dde2c6

Please sign in to comment.