Browse Source

[805] Simplify initialization

No need to create an opened socket and close it right away.
Michal 'vorner' Vaner 13 years ago
parent
commit
5345a3c2ba
1 changed files with 1 additions and 3 deletions
  1. 1 3
      src/lib/asiodns/udp_server.cc

+ 1 - 3
src/lib/asiodns/udp_server.cc

@@ -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);
     }