| 218 | } |
| 219 | |
| 220 | Status SetKeepAliveOptionsForSocket(THRIFT_SOCKET socket, int32_t probe_period_s, |
| 221 | int32_t retry_period_s, int32_t retry_count) { |
| 222 | if (probe_period_s > 0) { |
| 223 | RETURN_IF_ERROR(SetSockOpt(socket, IPPROTO_TCP, TCP_KEEPIDLE, |
| 224 | "TCP_KEEPIDLE (keepalive probe period)", probe_period_s)); |
| 225 | } |
| 226 | if (retry_period_s > 0) { |
| 227 | RETURN_IF_ERROR(SetSockOpt(socket, IPPROTO_TCP, TCP_KEEPINTVL, |
| 228 | "TCP_KEEPINTVL (keepalive retry period)", retry_period_s)); |
| 229 | } |
| 230 | if (retry_count > 0) { |
| 231 | RETURN_IF_ERROR(SetSockOpt(socket, IPPROTO_TCP, TCP_KEEPCNT, |
| 232 | "TCP_KEEPCNT (keepalive retry count)", retry_count)); |
| 233 | } |
| 234 | return Status::OK(); |
| 235 | } |
| 236 | |
| 237 | static void ThriftOutputFunction(const char* output) { |
| 238 | VLOG_QUERY << output; |
no test coverage detected