]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/admin: catch thrown exception
authorKefu Chai <kchai@redhat.com>
Fri, 24 Jul 2020 13:11:08 +0000 (21:11 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 27 Jul 2020 03:29:10 +0000 (11:29 +0800)
if the socket file exists, a std::system_error is thrown. and we should
catch it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/admin/admin_socket.cc

index db21e29f1e08173da9f7f3dbb193b5bf203255da..40f7cc834c6fb827e838e2569f389f472fd701f8 100644 (file)
@@ -233,7 +233,13 @@ seastar::future<> AdminSocket::start(const std::string& path)
 
   logger().debug("{}: asok socket path={}", __func__, path);
   auto sock_path = seastar::socket_address{ seastar::unix_domain_addr{ path } };
-  server_sock = seastar::engine().listen(sock_path);
+  try {
+    server_sock = seastar::engine().listen(sock_path);
+  } catch (const std::system_error& e) {
+    logger().error("{}: unable to listen({}): {}", __func__, path, e.what());
+    server_sock.reset();
+    return seastar::make_ready_future<>();
+  }
   // listen in background
   task = seastar::do_until(
     [this] { return stop_gate.is_closed(); },