| 6083 | } |
| 6084 | |
| 6085 | TSAction |
| 6086 | TSNetAccept(TSCont contp, int port, int domain, int accept_threads) |
| 6087 | { |
| 6088 | NetProcessor::AcceptOptions opt; |
| 6089 | |
| 6090 | sdk_assert(sdk_sanity_check_continuation(contp) == TS_SUCCESS); |
| 6091 | sdk_assert(port > 0); |
| 6092 | sdk_assert(accept_threads >= -1); |
| 6093 | |
| 6094 | // TODO: Does this imply that only one "accept thread" could be |
| 6095 | // doing an accept at any time? |
| 6096 | FORCE_PLUGIN_SCOPED_MUTEX(contp); |
| 6097 | |
| 6098 | opt = make_net_accept_options(nullptr, accept_threads); |
| 6099 | |
| 6100 | // If it's not IPv6, force to IPv4. |
| 6101 | opt.ip_family = domain == AF_INET6 ? AF_INET6 : AF_INET; |
| 6102 | opt.local_port = port; |
| 6103 | opt.frequent_accept = false; |
| 6104 | |
| 6105 | INKContInternal *i = reinterpret_cast<INKContInternal *>(contp); |
| 6106 | return reinterpret_cast<TSAction>(netProcessor.accept(i, opt)); |
| 6107 | } |
| 6108 | |
| 6109 | TSReturnCode |
| 6110 | TSNetAcceptNamedProtocol(TSCont contp, const char *protocol) |