From: Pieter Lexis Date: Thu, 22 Feb 2018 09:31:19 +0000 (+0100) Subject: ixfrdist: fix reading nits X-Git-Tag: dnsdist-1.3.0~82^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F6291%2Fhead;p=thirdparty%2Fpdns.git ixfrdist: fix reading nits --- diff --git a/pdns/ixfrdist.cc b/pdns/ixfrdist.cc index c6337553ef..7922074bca 100644 --- a/pdns/ixfrdist.cc +++ b/pdns/ixfrdist.cc @@ -620,33 +620,15 @@ void handleTCPRequest(int fd, boost::any&) { return; } - char buf[65535]; - int res; - res = recv(cfd, &buf, 2, 0); - if (res != 2) { - if (res == 0) { // Connection is closed - close(cfd); - return; - } - if (res == -1) { - auto savedErrno = errno; - cerr<<"[WARNING] Could not read message from "<(ntohs((buf[0]<<8) + buf[1])), sizeof(buf)); - res = recv(cfd, &buf, toRead, 0); - - if (res == -1) { - auto savedErrno = errno; - cerr<<"[WARNING] Could not read message from "<(sizeof(buf))); + res = readn2WithTimeout(cfd, &buf, toRead, 2); + } catch (runtime_error &e) { + cerr<<"[WARNING] Could not read message from "<