[svn] commit: r2335 - /branches/trac221/src/lib/xfr/xfrout_client.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Jun 29 22:39:41 UTC 2010


Author: jinmei
Date: Tue Jun 29 22:39:40 2010
New Revision: 2335

Log:
cleanup: use asio error code instead of exception.
we have to convert exceptions to isc::Exception anyway, so there's no advantage in using exceptions.

Modified:
    branches/trac221/src/lib/xfr/xfrout_client.cc

Modified: branches/trac221/src/lib/xfr/xfrout_client.cc
==============================================================================
--- branches/trac221/src/lib/xfr/xfrout_client.cc (original)
+++ branches/trac221/src/lib/xfr/xfrout_client.cc Tue Jun 29 22:39:40 2010
@@ -52,19 +52,19 @@
 
 void
 XfroutClient::connect() {
-    try {
-        impl_->socket_.connect(stream_protocol::endpoint(impl_->file_path_));
-    } catch (const asio::system_error& ex) {
-        isc_throw(XfroutError, "socket connect failed: " << ex.what());
+    asio::error_code err;
+    impl_->socket_.connect(stream_protocol::endpoint(impl_->file_path_), err);
+    if (err) {
+        isc_throw(XfroutError, "socket connect failed: " << err.message());
     }
 }
 
 void
 XfroutClient::disconnect() {
-    try {
-        impl_->socket_.close();
-    } catch (const asio::system_error& ex) {
-        isc_throw(XfroutError, "close socket failed: " << ex.what());
+    asio::error_code err;
+    impl_->socket_.close(err);
+    if (err) {
+        isc_throw(XfroutError, "close socket failed: " << err.message());
     }
 }
 
@@ -78,7 +78,8 @@
                   "Fail to send socket descriptor to xfrout module");
     }
 
-    // XXX: this shouldn't be blocking send, even though it's unlikely to block.
+    // XXX: this shouldn't be blocking send, even though it's unlikely to
+    // block.
     const uint8_t lenbuf[2] = { msg_len >> 8, msg_len & 0xff };
     if (send(impl_->socket_.native(), lenbuf, sizeof(lenbuf), 0) !=
         sizeof(lenbuf)) {




More information about the bind10-changes mailing list