| 329 | } |
| 330 | |
| 331 | bool OutputDataSocket::init(const std::string &path) |
| 332 | { |
| 333 | ldout(m_cct, 5) << "init " << path << dendl; |
| 334 | |
| 335 | /* Set up things for the new thread */ |
| 336 | std::string err; |
| 337 | int pipe_rd = -1, pipe_wr = -1; |
| 338 | err = create_shutdown_pipe(&pipe_rd, &pipe_wr); |
| 339 | if (!err.empty()) { |
| 340 | lderr(m_cct) << "OutputDataSocketConfigObs::init: error: " << err << dendl; |
| 341 | return false; |
| 342 | } |
| 343 | int sock_fd; |
| 344 | err = bind_and_listen(path, &sock_fd); |
| 345 | if (!err.empty()) { |
| 346 | lderr(m_cct) << "OutputDataSocketConfigObs::init: failed: " << err << dendl; |
| 347 | close(pipe_rd); |
| 348 | close(pipe_wr); |
| 349 | return false; |
| 350 | } |
| 351 | |
| 352 | /* Create new thread */ |
| 353 | m_sock_fd = sock_fd; |
| 354 | m_shutdown_rd_fd = pipe_rd; |
| 355 | m_shutdown_wr_fd = pipe_wr; |
| 356 | m_path = path; |
| 357 | create("out_data_socket"); |
| 358 | add_cleanup_file(m_path.c_str()); |
| 359 | return true; |
| 360 | } |
| 361 | |
| 362 | void OutputDataSocket::shutdown() |
| 363 | { |
nothing calls this directly
no test coverage detected