Browse Source

add exception check for asio socket connect and close

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac221@2241 e5f2f494-b856-4b98-b285-d166d9295462
Han Feng 15 years ago
parent
commit
ad22927add
1 changed files with 12 additions and 2 deletions
  1. 12 2
      src/lib/xfr/xfrout_client.cc

+ 12 - 2
src/lib/xfr/xfrout_client.cc

@@ -52,12 +52,22 @@ XfroutClient::~XfroutClient()
 
 void
 XfroutClient::connect() {
-    impl_->socket_.connect(stream_protocol::endpoint(impl_->file_path_));
+    try {
+        impl_->socket_.connect(stream_protocol::endpoint(impl_->file_path_));
+    } catch (const asio::system_error &) {
+        isc_throw(XfroutError, 
+                "socket connect failed");
+    }
 }
 
 void
 XfroutClient::disconnect() {
-    impl_->socket_.close();
+    try {
+        impl_->socket_.close();
+    } catch (const asio::system_error &) {
+        isc_throw(XfroutError,
+                "close socket failed");
+    }
 }
 
 int