report_error() cleanup
This commit is contained in:
parent
ba1a1399c7
commit
825ddf1363
4 changed files with 13 additions and 38 deletions
|
@ -197,16 +197,12 @@ inetport(listener_t *listener)
|
|||
|
||||
if(F == NULL)
|
||||
{
|
||||
report_error("opening listener socket %s:%s",
|
||||
get_listener_name(listener),
|
||||
get_listener_name(listener), errno);
|
||||
ilog_error("opening listener socket");
|
||||
return 0;
|
||||
}
|
||||
else if((maxconnections - 10) < rb_get_fd(F)) /* XXX this is kinda bogus*/
|
||||
{
|
||||
report_error("no more connections left for listener %s:%s",
|
||||
get_listener_name(listener),
|
||||
get_listener_name(listener), errno);
|
||||
ilog_error("no more connections left for listener");
|
||||
rb_close(F);
|
||||
return 0;
|
||||
}
|
||||
|
@ -217,9 +213,7 @@ inetport(listener_t *listener)
|
|||
*/
|
||||
if(setsockopt(rb_get_fd(F), SOL_SOCKET, SO_REUSEADDR, (char *) &opt, sizeof(opt)))
|
||||
{
|
||||
report_error("setting SO_REUSEADDR for listener %s:%s",
|
||||
get_listener_name(listener),
|
||||
get_listener_name(listener), errno);
|
||||
ilog_error("setting SO_REUSEADDR for listener");
|
||||
rb_close(F);
|
||||
return 0;
|
||||
}
|
||||
|
@ -231,18 +225,14 @@ inetport(listener_t *listener)
|
|||
|
||||
if(bind(rb_get_fd(F), (struct sockaddr *) &listener->addr, GET_SS_LEN(&listener->addr)))
|
||||
{
|
||||
report_error("binding listener socket %s:%s",
|
||||
get_listener_name(listener),
|
||||
get_listener_name(listener), errno);
|
||||
ilog_error("binding listener socket");
|
||||
rb_close(F);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((ret = rb_listen(F, RATBOX_SOMAXCONN)))
|
||||
{
|
||||
report_error("listen failed for %s:%s",
|
||||
get_listener_name(listener),
|
||||
get_listener_name(listener), errno);
|
||||
ilog_error("listen()");
|
||||
rb_close(F);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -273,9 +273,7 @@ start_auth_query(struct AuthRequest *auth)
|
|||
family = auth->client->localClient->ip.ss_family;
|
||||
if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL)
|
||||
{
|
||||
report_error("creating auth stream socket %s:%s",
|
||||
get_client_name(auth->client, SHOW_IP),
|
||||
log_client_name(auth->client, SHOW_IP), errno);
|
||||
ilog_error("creating auth stream socket");
|
||||
++ServerStats->is_abad;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ smalldate(void)
|
|||
void
|
||||
ilog_error(const char *error)
|
||||
{
|
||||
ilog(L_IOERROR, "%s: %d (%s)", buf, errno, strerror(errno));
|
||||
ilog(L_IOERROR, "%s: %d (%s)", error, errno, strerror(errno));
|
||||
|
||||
sendto_opers_snomask(SNO_DEBUG, L_ALL, "%s: %d (%s)", buf, errno, strerror(errno));
|
||||
sendto_realops_snomask(SNO_DEBUG, L_ALL, "%s: %d (%s)", error, errno, strerror(errno));
|
||||
}
|
||||
|
|
23
src/s_serv.c
23
src/s_serv.c
|
@ -1061,9 +1061,7 @@ server_estab(struct Client *client_p)
|
|||
}
|
||||
|
||||
if(!rb_set_buffers(client_p->localClient->F, READBUF_SIZE))
|
||||
report_error("rb_set_buffers failed for server %s:%s",
|
||||
get_server_name(client_p, SHOW_IP),
|
||||
log_client_name(client_p, SHOW_IP), errno);
|
||||
ilog_error("rb_set_buffers failed for server");
|
||||
|
||||
/* Hand the server off to servlink now */
|
||||
if(IsCapable(client_p, CAP_ZIP))
|
||||
|
@ -1414,18 +1412,12 @@ fork_server(struct Client *server)
|
|||
|
||||
if(!rb_set_nb(server->localClient->F))
|
||||
{
|
||||
report_error("Cannot set slink fd nonblocking for server %s:%s",
|
||||
get_server_name(server, SHOW_IP),
|
||||
log_client_name(server, SHOW_IP),
|
||||
errno);
|
||||
ilog_error("setting a slink fd nonblocking");
|
||||
}
|
||||
|
||||
/* if(!rb_set_nb(server->localClient->ctrlfd))
|
||||
{
|
||||
report_error("Cannot set slink fd nonblocking for server %s:%s",
|
||||
get_server_name(server, SHOW_IP),
|
||||
log_client_name(server, SHOW_IP),
|
||||
errno);
|
||||
ilog_error("setting a slink fd nonblocking");
|
||||
}
|
||||
|
||||
rb_open(server->localClient->ctrlfd, FD_SOCKET, NULL);
|
||||
|
@ -1517,9 +1509,7 @@ serv_connect(struct server_conf *server_p, struct Client *by)
|
|||
/* create a socket for the server connection */
|
||||
if((F = rb_socket(server_p->aftype, SOCK_STREAM, 0, NULL)) != NULL)
|
||||
{
|
||||
/* Eek, failure to create the socket */
|
||||
report_error("opening stream socket to %s: %s",
|
||||
server_p->name, server_p->name, errno);
|
||||
ilog_error("opening a stream socket");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1547,10 +1537,7 @@ serv_connect(struct server_conf *server_p, struct Client *by)
|
|||
|
||||
if(!rb_set_buffers(client_p->localClient->F, READBUF_SIZE))
|
||||
{
|
||||
report_error("rb_set_buffers failed for server %s:%s",
|
||||
get_server_name(client_p, SHOW_IP),
|
||||
log_client_name(client_p, SHOW_IP),
|
||||
errno);
|
||||
ilog_error("setting the buffer size for a server connection");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue