Parcourir la 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 il y a 15 ans
Parent
commit
ad22927add
1 fichiers modifiés avec 12 ajouts et 2 suppressions
  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