Commit 9d171c0b authored by Shane Kerr's avatar Shane Kerr

At Jinmei's suggestion, also handle errors in recv() and send().



git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1544 e5f2f494-b856-4b98-b285-d166d9295462
parent c8575d7a
......@@ -473,6 +473,8 @@ processMessageUDP(const int fd, Message& dns_message,
}
}
// XXX: this function does not handle partial reads or partial writes,
// and is VERY UNSAFE - will probably be removed or rewritten
void
processMessageTCP(const int fd, Message& dns_message,
MessageRenderer& response_renderer)
......@@ -495,6 +497,13 @@ processMessageTCP(const int fd, Message& dns_message,
cerr << "[XX] process TCP" << endl;
}
cc = recv(ts, sizebuf, 2, 0);
if (cc < 0) {
if (verbose_mode) {
cerr << "[XX] TCP recv failure:" << endl;
}
close(ts);
return;
}
if (verbose_mode) {
cerr << "[XX] got: " << cc << endl;
}
......@@ -549,6 +558,10 @@ processMessageTCP(const int fd, Message& dns_message,
<< endl;
}
}
} else {
if (verbose_mode) {
cerr << "TCP send error" << endl;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment