mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
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)
|
if(F == NULL)
|
||||||
{
|
{
|
||||||
report_error("opening listener socket %s:%s",
|
ilog_error("opening listener socket");
|
||||||
get_listener_name(listener),
|
|
||||||
get_listener_name(listener), errno);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if((maxconnections - 10) < rb_get_fd(F)) /* XXX this is kinda bogus*/
|
else if((maxconnections - 10) < rb_get_fd(F)) /* XXX this is kinda bogus*/
|
||||||
{
|
{
|
||||||
report_error("no more connections left for listener %s:%s",
|
ilog_error("no more connections left for listener");
|
||||||
get_listener_name(listener),
|
|
||||||
get_listener_name(listener), errno);
|
|
||||||
rb_close(F);
|
rb_close(F);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -217,9 +213,7 @@ inetport(listener_t *listener)
|
||||||
*/
|
*/
|
||||||
if(setsockopt(rb_get_fd(F), SOL_SOCKET, SO_REUSEADDR, (char *) &opt, sizeof(opt)))
|
if(setsockopt(rb_get_fd(F), SOL_SOCKET, SO_REUSEADDR, (char *) &opt, sizeof(opt)))
|
||||||
{
|
{
|
||||||
report_error("setting SO_REUSEADDR for listener %s:%s",
|
ilog_error("setting SO_REUSEADDR for listener");
|
||||||
get_listener_name(listener),
|
|
||||||
get_listener_name(listener), errno);
|
|
||||||
rb_close(F);
|
rb_close(F);
|
||||||
return 0;
|
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)))
|
if(bind(rb_get_fd(F), (struct sockaddr *) &listener->addr, GET_SS_LEN(&listener->addr)))
|
||||||
{
|
{
|
||||||
report_error("binding listener socket %s:%s",
|
ilog_error("binding listener socket");
|
||||||
get_listener_name(listener),
|
|
||||||
get_listener_name(listener), errno);
|
|
||||||
rb_close(F);
|
rb_close(F);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((ret = rb_listen(F, RATBOX_SOMAXCONN)))
|
if((ret = rb_listen(F, RATBOX_SOMAXCONN)))
|
||||||
{
|
{
|
||||||
report_error("listen failed for %s:%s",
|
ilog_error("listen()");
|
||||||
get_listener_name(listener),
|
|
||||||
get_listener_name(listener), errno);
|
|
||||||
rb_close(F);
|
rb_close(F);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,9 +273,7 @@ start_auth_query(struct AuthRequest *auth)
|
||||||
family = auth->client->localClient->ip.ss_family;
|
family = auth->client->localClient->ip.ss_family;
|
||||||
if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL)
|
if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL)
|
||||||
{
|
{
|
||||||
report_error("creating auth stream socket %s:%s",
|
ilog_error("creating auth stream socket");
|
||||||
get_client_name(auth->client, SHOW_IP),
|
|
||||||
log_client_name(auth->client, SHOW_IP), errno);
|
|
||||||
++ServerStats->is_abad;
|
++ServerStats->is_abad;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,7 +227,7 @@ smalldate(void)
|
||||||
void
|
void
|
||||||
ilog_error(const char *error)
|
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))
|
if(!rb_set_buffers(client_p->localClient->F, READBUF_SIZE))
|
||||||
report_error("rb_set_buffers failed for server %s:%s",
|
ilog_error("rb_set_buffers failed for server");
|
||||||
get_server_name(client_p, SHOW_IP),
|
|
||||||
log_client_name(client_p, SHOW_IP), errno);
|
|
||||||
|
|
||||||
/* Hand the server off to servlink now */
|
/* Hand the server off to servlink now */
|
||||||
if(IsCapable(client_p, CAP_ZIP))
|
if(IsCapable(client_p, CAP_ZIP))
|
||||||
|
@ -1414,18 +1412,12 @@ fork_server(struct Client *server)
|
||||||
|
|
||||||
if(!rb_set_nb(server->localClient->F))
|
if(!rb_set_nb(server->localClient->F))
|
||||||
{
|
{
|
||||||
report_error("Cannot set slink fd nonblocking for server %s:%s",
|
ilog_error("setting a slink fd nonblocking");
|
||||||
get_server_name(server, SHOW_IP),
|
|
||||||
log_client_name(server, SHOW_IP),
|
|
||||||
errno);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if(!rb_set_nb(server->localClient->ctrlfd))
|
/* if(!rb_set_nb(server->localClient->ctrlfd))
|
||||||
{
|
{
|
||||||
report_error("Cannot set slink fd nonblocking for server %s:%s",
|
ilog_error("setting a slink fd nonblocking");
|
||||||
get_server_name(server, SHOW_IP),
|
|
||||||
log_client_name(server, SHOW_IP),
|
|
||||||
errno);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_open(server->localClient->ctrlfd, FD_SOCKET, NULL);
|
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 */
|
/* create a socket for the server connection */
|
||||||
if((F = rb_socket(server_p->aftype, SOCK_STREAM, 0, NULL)) != NULL)
|
if((F = rb_socket(server_p->aftype, SOCK_STREAM, 0, NULL)) != NULL)
|
||||||
{
|
{
|
||||||
/* Eek, failure to create the socket */
|
ilog_error("opening a stream socket");
|
||||||
report_error("opening stream socket to %s: %s",
|
|
||||||
server_p->name, server_p->name, errno);
|
|
||||||
return 0;
|
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))
|
if(!rb_set_buffers(client_p->localClient->F, READBUF_SIZE))
|
||||||
{
|
{
|
||||||
report_error("rb_set_buffers failed for server %s:%s",
|
ilog_error("setting the buffer size for a server connection");
|
||||||
get_server_name(client_p, SHOW_IP),
|
|
||||||
log_client_name(client_p, SHOW_IP),
|
|
||||||
errno);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue