Browse Source

[2903] an unrelated small optimization: use const_buffers_1 for send.

asio::buffer is internally converted to this form, so this is (in theory)
more efficient.
JINMEI Tatuya 12 years ago
parent
commit
4ee02ef54b
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/lib/asiodns/sync_udp_server.cc

+ 3 - 4
src/lib/asiodns/sync_udp_server.cc

@@ -152,13 +152,12 @@ SyncUDPServer::handleRead(const asio::error_code& ec, const size_t length) {
         }
 
         asio::error_code ec;
-        socket_->send_to(asio::buffer(output_buffer_->getData(),
-                                      output_buffer_->getLength()),
+        socket_->send_to(asio::const_buffers_1(output_buffer_->getData(),
+                                               output_buffer_->getLength()),
                          sender_, 0, ec);
         if (ec) {
             LOG_ERROR(logger, ASIODNS_UDP_SYNC_SEND_FAIL).
-                      arg(sender_.address().to_string()).
-                      arg(ec.message());
+                      arg(sender_.address().to_string()).arg(ec.message());
         }
     }