| 313 | } |
| 314 | |
| 315 | int bind(const EndPoint& ep) override { |
| 316 | auto s = sockaddr_storage(ep); |
| 317 | if (m_listen_fd < 0) { |
| 318 | m_listen_fd = socket(s.get_sockaddr()->sa_family, 0, m_nonblocking, true); |
| 319 | if (m_listen_fd < 0) return -1; |
| 320 | } |
| 321 | if (m_opts.setsockopt(m_listen_fd) != 0) { |
| 322 | return -1; |
| 323 | } |
| 324 | int ret = ::bind(m_listen_fd, s.get_sockaddr(), s.get_socklen()); |
| 325 | if (ret < 0) |
| 326 | LOG_ERRNO_RETURN(0, ret, "failed to bind to ", s.to_endpoint()); |
| 327 | return 0; |
| 328 | } |
| 329 | |
| 330 | int bind(const char* path, size_t count) override { |
| 331 | if (m_autoremove && is_socket(path)) { |
nothing calls this directly
no test coverage detected