]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[805] Simplify initialization
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Tue, 6 Dec 2011 15:23:07 +0000 (16:23 +0100)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Tue, 6 Dec 2011 15:23:07 +0000 (16:23 +0100)
No need to create an opened socket and close it right away.

src/lib/asiodns/udp_server.cc

index 69dcade4c87833569e52fe6dde96328730f8d1ff..a47e699e6a960befe2ff5029652bebdbeed8d3ae 100644 (file)
@@ -83,9 +83,7 @@ struct UDPServer::Data {
         // We must use different instantiations for v4 and v6;
         // otherwise ASIO will bind to both
         udp proto = v6 ? udp::v6() : udp::v4();
-        socket_.reset(new udp::socket(io_service, proto));
-        // For some strange reason, without this, the assign throws an exception.
-        socket_->close();
+        socket_.reset(new udp::socket(io_service));
         socket_->assign(proto, fd);
     }