stat = ap_setsocketopt(s, APR_SO_REUSEADDR, one);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_CRIT, stat, NULL,
"make_sock: for %s, setsockopt: (SO_REUSEADDR)", addr);
ap_close_socket(s);
return stat;
stat = ap_setsocketopt(s, APR_SO_KEEPALIVE, one);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_CRIT, stat, NULL,
"make_sock: for %s, setsockopt: (SO_KEEPALIVE)", addr);
ap_close_socket(s);
return stat;
if (send_buffer_size) {
stat = ap_setsocketopt(s, APR_SO_SNDBUF, send_buffer_size);
if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {
- ap_log_error(APLOG_MARK, APLOG_WARNING, NULL,
+ ap_log_error(APLOG_MARK, APLOG_WARNING, stat, NULL,
"make_sock: failed to set SendBufferSize for %s, "
"using default", addr);
/* not a fatal error */
}
if ((stat = ap_bind(s)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
+ ap_log_error(APLOG_MARK, APLOG_CRIT, stat, NULL,
"make_sock: could not bind to %s", addr);
ap_close_socket(s);
return stat;
}
if ((stat = ap_listen(s, ap_listenbacklog)) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_ERR, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ERR, stat, NULL,
"make_sock: unable to listen for connections on %s", addr);
ap_close_socket(s);
return stat;
{
ap_listen_rec **walk;
ap_listen_rec *new;
- char oldaddr[17];
+ ap_status_t status;
+ char *oldaddr;
unsigned int oldport;
/* see if we've got an old listener for this address:port */
for (walk = &old_listeners; *walk; walk = &(*walk)->next) {
- ap_getport(&oldport, (*walk)->sd);
- ap_getipaddr(oldaddr,sizeof oldaddr,(*walk)->sd);
+ ap_get_local_port(&oldport, (*walk)->sd);
+ ap_get_local_ipaddr(&oldaddr,(*walk)->sd);
if (!strcmp(oldaddr, addr) && port == oldport) {
/* re-use existing record */
new = *walk;
/* XXX - We need to deal with freeing this structure properly. */
new = ap_palloc(process->pool, sizeof(ap_listen_rec));
new->active = 0;
- if (ap_create_tcp_socket(&new->sd, NULL) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
+ if ((status = ap_create_tcp_socket(&new->sd, NULL)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, NULL,
"make_sock: failed to get a socket for %s", addr);
return;
}
- ap_setport(new->sd, port);
- ap_setipaddr(new->sd, addr);
+ ap_set_local_port(new->sd, port);
+ ap_set_local_ipaddr(new->sd, addr);
new->next = ap_listeners;
ap_listeners = new;
}