[svn] commit: r2634 - /branches/trac296/src/lib/cc/session.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Aug 4 19:54:38 UTC 2010


Author: jelte
Date: Wed Aug  4 19:54:38 2010
New Revision: 2634

Log:
small update for jinmei's comments

Modified:
    branches/trac296/src/lib/cc/session.cc

Modified: branches/trac296/src/lib/cc/session.cc
==============================================================================
--- branches/trac296/src/lib/cc/session.cc (original)
+++ branches/trac296/src/lib/cc/session.cc Wed Aug  4 19:54:38 2010
@@ -138,8 +138,7 @@
 }
 
 void
-SessionImpl::setResult(bool* result, asio::error_code b)
-{
+SessionImpl::setResult(bool* result, const asio::error_code b) {
     if (b != asio::error::operation_aborted) {
         *result = true;
     }
@@ -150,13 +149,15 @@
     bool timer_result = false;
     bool read_result = false;
     try {
-        async_read(socket_, asio::buffer(data, datalen), asio::transfer_at_least( datalen ),
-            boost::bind(&SessionImpl::setResult, this, &read_result, _1));
+        asio::async_read(socket_, asio::buffer(data, datalen),
+                         boost::bind(&SessionImpl::setResult, this,
+                                     &read_result, _1));
         asio::deadline_timer timer(socket_.io_service());
     
         if (timeout != 0) {
             timer.expires_from_now(boost::posix_time::seconds(timeout));
-            timer.async_wait(boost::bind(&SessionImpl::setResult, this, &timer_result, _1));
+            timer.async_wait(boost::bind(&SessionImpl::setResult,
+                                         this, &timer_result, _1));
         }
     
         while (!read_result && !timer_result) {
@@ -169,7 +170,7 @@
         }
     
         if (!read_result) {
-            isc_throw(SessionTimeout, "Timeout or error on ");
+            isc_throw(SessionTimeout, "Timeout or error while reading data from cc session");
         }
     } catch (const asio::system_error& asio_ex) {
         // to hide boost specific exceptions, we catch them explicitly
@@ -182,11 +183,11 @@
 SessionImpl::startRead(boost::function<void()> user_handler) {
     data_length_ = 0;
     user_handler_ = user_handler;
-    async_read(socket_, asio::buffer(&data_length_,
-                                            sizeof(data_length_)),
-               boost::bind(&SessionImpl::internalRead, this,
-                           asio::placeholders::error,
-                           asio::placeholders::bytes_transferred));
+    asio::async_read(socket_, asio::buffer(&data_length_,
+                                           sizeof(data_length_)),
+                     boost::bind(&SessionImpl::internalRead, this,
+                                 asio::placeholders::error,
+                                 asio::placeholders::bytes_transferred));
 }
 
 void




More information about the bind10-changes mailing list