]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2903] clarified one case after YIELD where the error shouldn't happen.
authorJINMEI Tatuya <jinmei@isc.org>
Mon, 29 Apr 2013 21:39:32 +0000 (14:39 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Mon, 29 Apr 2013 21:39:32 +0000 (14:39 -0700)
use assert() rather than ignoring it; we should be able to assert it safely
in this case.

src/lib/asiodns/tcp_server.cc

index e31c7bbdbd885809e26cfd99678643f491835923..06e13ef63307ab126311c29d793f1fe39dd62b0b 100644 (file)
 
 #include <config.h>
 
-#include <unistd.h>             // for some IPC/network system calls
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <errno.h>
-
-#include <boost/shared_array.hpp>
-
 #include <log/dummylog.h>
 
 #include <util/buffer.h>
 #include <asiodns/tcp_server.h>
 #include <asiodns/logger.h>
 
+#include <boost/shared_array.hpp>
+
+#include <cassert>
+#include <unistd.h>             // for some IPC/network system calls
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <errno.h>
+
 using namespace asio;
 using asio::ip::udp;
 using asio::ip::tcp;
@@ -220,11 +221,11 @@ TCPServer::operator()(asio::error_code ec, size_t length) {
 
         // Schedule a DNS lookup, and yield.  When the lookup is
         // finished, the coroutine will resume immediately after
-        // this point.
+        // this point.  On resume, this method should be called with its
+        // default parameter values (because of the signature of post()'s
+        // handler), so ec shouldn't indicate any error.
         CORO_YIELD io_.post(AsyncLookup<TCPServer>(*this));
-        if (ec) {
-            return;
-        }
+        assert(!ec);
 
         // The 'done_' flag indicates whether we have an answer
         // to send back.  If not, exit the coroutine permanently.