| 29 | } |
| 30 | |
| 31 | void |
| 32 | socket_args::set(const config& conf) |
| 33 | { |
| 34 | timeout = conf.get_int("timeout", 600); |
| 35 | listen_backlog = conf.get_int("listen_backlog", 256); |
| 36 | std::string node = conf.get_str("host", ""); |
| 37 | std::string port = conf.get_str("port", ""); |
| 38 | if (!node.empty() || !port.empty()) { |
| 39 | if (family == AF_UNIX || node == "/") { |
| 40 | set_unix_domain(port.c_str()); |
| 41 | } else { |
| 42 | const char *nd = node.empty() ? 0 : node.c_str(); |
| 43 | if (resolve(nd, port.c_str()) != 0) { |
| 44 | fatal_exit("getaddrinfo failed: " + node + ":" + port); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | sndbuf = conf.get_int("sndbuf", 0); |
| 49 | rcvbuf = conf.get_int("rcvbuf", 0); |
| 50 | } |
| 51 | |
| 52 | void |
| 53 | socket_args::set_unix_domain(const char *path) |