| 578 | } |
| 579 | |
| 580 | Status Socket::SetTimeout(int opt, const char* optname, const MonoDelta& timeout) { |
| 581 | if (PREDICT_FALSE(timeout.ToNanoseconds() < 0)) { |
| 582 | return Status::InvalidArgument("Timeout specified as negative to SetTimeout", |
| 583 | timeout.ToString()); |
| 584 | } |
| 585 | struct timeval tv; |
| 586 | timeout.ToTimeVal(&tv); |
| 587 | RETURN_NOT_OK_PREPEND(SetSockOpt(SOL_SOCKET, opt, tv), |
| 588 | Substitute("failed to set socket option $0 to $1", |
| 589 | optname, timeout.ToString())); |
| 590 | return Status::OK(); |
| 591 | } |
| 592 | |
| 593 | Status Socket::SetTcpKeepAlive(int idle_time_s, int retry_time_s, int num_retries) { |
| 594 | #if defined(__linux__) |
nothing calls this directly
no test coverage detected