Browse Source

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.


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac221@2335 e5f2f494-b856-4b98-b285-d166d9295462

JINMEI Tatuya 15 years ago
parent
commit
3d8cbc4a02
1 changed files with 10 additions and 9 deletions
  1. 10 9
      src/lib/xfr/xfrout_client.cc

+ 10 - 9
src/lib/xfr/xfrout_client.cc

@@ -52,19 +52,19 @@ XfroutClient::~XfroutClient()
 
 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 @@ XfroutClient::sendXfroutRequestInfo(const int tcp_sock,
                   "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)) {