/* Set a timeout on the socket */
if (conf->timeout_set == 1) {
- apr_setsocketopt(sock, APR_SO_TIMEOUT, (int)conf->timeout);
+ apr_socket_timeout_set(sock, conf->timeout);
}
else {
- apr_setsocketopt(sock,
- APR_SO_TIMEOUT, (int)r->server->timeout);
+ apr_socket_timeout_set(sock, r->server->timeout);
}
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
apr_size_t buffer_len = 1;
char test_buffer[1];
apr_status_t socket_status;
- apr_short_interval_time_t current_timeout;
+ apr_interval_time_t current_timeout;
/* use previous keepalive socket */
*origin = backend->connection;
new = 0;
/* save timeout */
- apr_getsocketopt(p_conn->sock, APR_SO_TIMEOUT, ¤t_timeout);
+ apr_socket_timeout_get(p_conn->sock, ¤t_timeout);
/* set no timeout */
- apr_setsocketopt(p_conn->sock, APR_SO_TIMEOUT, 0);
+ apr_socket_timeout_set(p_conn->sock, 0);
socket_status = apr_recv(p_conn->sock, test_buffer, &buffer_len);
/* put back old timeout */
- apr_setsocketopt(p_conn->sock, APR_SO_TIMEOUT, current_timeout);
+ apr_socket_timeout_set(p_conn->sock, current_timeout);
if ( APR_STATUS_IS_EOF(socket_status) ) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
"proxy: HTTP: previous connection is closed");
/* Set a timeout on the socket */
if (conf->timeout_set == 1) {
- apr_setsocketopt(*newsock, APR_SO_TIMEOUT, (int)conf->timeout);
+ apr_socket_timeout_set(*newsock, conf->timeout);
}
else {
- apr_setsocketopt(*newsock, APR_SO_TIMEOUT, (int)s->timeout);
+ apr_socket_timeout_set(*newsock, s->timeout);
}
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
* not send us bytes within 2 seconds (a value pulled from Apache 1.3
* which seems to work well), close the connection.
*/
- timeout = SECONDS_TO_LINGER * APR_USEC_PER_SEC;
- apr_setsocketopt(csd, APR_SO_TIMEOUT, timeout);
+ timeout = apr_time_from_sec(SECONDS_TO_LINGER);
+ apr_socket_timeout_set(csd, timeout);
apr_setsocketopt(csd, APR_INCOMPLETE_READ, 1);
while (1) {
nbytes = sizeof(dummybuf);
{
apr_status_t rv;
#ifdef AP_DEBUG
- apr_int32_t timeout = 0;
+ apr_interval_time_t timeout = 0;
#endif
- AP_DEBUG_ASSERT((apr_getsocketopt(c->client_socket, APR_SO_TIMEOUT,
- &timeout) == APR_SUCCESS)
+ AP_DEBUG_ASSERT((apr_socket_timeout_get(c->client_socket, &timeout)
+ == APR_SUCCESS)
&& timeout > 0); /* socket must be in timeout mode */
do {
if (mode != AP_MODE_INIT && mode != AP_MODE_EATCRLF) {
if (*first_line) {
- apr_setsocketopt(csd, APR_SO_TIMEOUT,
- (int)(keptalive
- ? f->c->base_server->keep_alive_timeout
- : f->c->base_server->timeout));
+ apr_socket_timeout_set(csd,
+ keptalive
+ ? f->c->base_server->keep_alive_timeout
+ : f->c->base_server->timeout);
*first_line = 0;
}
else {
if (keptalive) {
- apr_setsocketopt(csd, APR_SO_TIMEOUT,
- (int)(f->c->base_server->timeout));
+ apr_socket_timeout_set(csd, f->c->base_server->timeout);
}
}
}
* because the MPM won't want to hold up a graceful restart for a
* long time
*/
- rv = apr_setsocketopt(sock, APR_SO_TIMEOUT, 3 * APR_USEC_PER_SEC);
+ rv = apr_socket_timeout_set(sock, apr_time_from_sec(3));
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
"set timeout on socket to connect to listener");
return rv;
}
- if ((rv = apr_setsocketopt(*newsock, APR_SO_TIMEOUT,
- (apr_int32_t)(ap_rfc1413_timeout
- * APR_USEC_PER_SEC)))
- != APR_SUCCESS) {
+ if ((rv = apr_socket_timeout_set(*newsock, APR_SO_TIMEOUT,
+ apr_time_from_sec(ap_rfc1413_timeout)))
+ != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, srv,
"rfc1413: error setting query socket timeout");
apr_socket_close(*newsock);