1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-06 11:53:12 +02:00

Get rid of Debug(()) function calls. I never use it anyway.

This commit is contained in:
Bram Matthys
2021-07-12 18:54:05 +02:00
parent a57bdba220
commit 05aeba9ba9
21 changed files with 2 additions and 105 deletions
-2
View File
@@ -280,10 +280,8 @@
#define IRCD_PIDFILE PIDFILE
#ifdef DEBUGMODE
#define Debug(x) debug x
#define LOGFILE LPATH
#else
#define Debug(x) ;
#define LOGFILE "/dev/null"
#endif
-2
View File
@@ -223,7 +223,6 @@ Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode)
}
if (i == EXTCMODETABLESZ)
{
Debug((DEBUG_DEBUG, "CmodeAdd failed, no space"));
if (module)
module->errorcode = MODERR_NOSPACE;
return NULL;
@@ -243,7 +242,6 @@ Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode)
{
if (paraslot == MAXPARAMMODES - 1)
{
Debug((DEBUG_DEBUG, "CmodeAdd failed, no space for parameter"));
if (module)
module->errorcode = MODERR_NOSPACE;
return NULL;
-4
View File
@@ -189,8 +189,6 @@ Umode *UmodeAdd(Module *module, char ch, int global, int unset_on_deoper, int (*
Usermode_Table[i].flag = ch;
Usermode_Table[i].allowed = allowed;
Usermode_Table[i].unset_on_deoper = unset_on_deoper;
Debug((DEBUG_DEBUG, "UmodeAdd(%c) returning %04lx",
ch, Usermode_Table[i].mode));
/* Update usermode table highest */
for (j = 0; j < UMODETABLESZ; j++)
if (Usermode_Table[i].flag)
@@ -214,7 +212,6 @@ Umode *UmodeAdd(Module *module, char ch, int global, int unset_on_deoper, int (*
}
else
{
Debug((DEBUG_DEBUG, "UmodeAdd failed, no space"));
if (module)
module->errorcode = MODERR_NOSPACE;
return NULL;
@@ -309,7 +306,6 @@ Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(Client *client, int
}
else
{
Debug((DEBUG_DEBUG, "SnomaskAdd failed, no space"));
*mode = 0;
if (module)
module->errorcode = MODERR_NOSPACE;
-7
View File
@@ -2511,13 +2511,10 @@ void config_rehash()
next = (ListStruct *)link_ptr->next;
if (link_ptr->refcount == 0)
{
Debug((DEBUG_ERROR, "s_conf: deleting block %s (refcount 0)", link_ptr->servername));
delete_linkblock(link_ptr);
}
else
{
Debug((DEBUG_ERROR, "s_conf: marking block %s (refcount %d) as temporary",
link_ptr->servername, link_ptr->refcount));
link_ptr->flag.temporary = 1;
}
}
@@ -10840,8 +10837,6 @@ void link_cleanup(ConfigItem_link *link_ptr)
void delete_linkblock(ConfigItem_link *link_ptr)
{
Debug((DEBUG_ERROR, "delete_linkblock: deleting %s, refcount=%d",
link_ptr->servername, link_ptr->refcount));
if (link_ptr->class)
{
link_ptr->class->xrefcount--;
@@ -10860,8 +10855,6 @@ void delete_linkblock(ConfigItem_link *link_ptr)
void delete_classblock(ConfigItem_class *class_ptr)
{
Debug((DEBUG_ERROR, "delete_classblock: deleting %s, clients=%d, xrefcount=%d",
class_ptr->name, class_ptr->clients, class_ptr->xrefcount));
safe_free(class_ptr->name);
DelListItem(class_ptr, conf_class);
safe_free(class_ptr);
-5
View File
@@ -372,11 +372,6 @@ char *crule_parse(char *rule)
}
if (ruleroot != NULL)
crule_free((char **)&ruleroot);
#if !defined(CR_DEBUG) && !defined(CR_CHKCONF)
Debug((DEBUG_ERROR, "%s in rule: %s", crule_errstr[errcode], rule));
#else
(void)fprintf(stderr, "%s in rule: %s\n", crule_errstr[errcode], rule);
#endif
return NULL;
}
-40
View File
@@ -179,7 +179,6 @@ void server_reboot(char *mesg)
int i;
Client *client;
sendto_realops("Aieeeee!!! Restarting server... %s", mesg);
Debug((DEBUG_NOTICE, "Restarting server... %s", mesg));
list_for_each_entry(client, &lclient_list, lclient_node)
(void) send_queued(client);
@@ -206,12 +205,6 @@ void server_reboot(char *mesg)
CleanUp();
WinExec(cmdLine, SW_SHOWDEFAULT);
}
#endif
#ifndef _WIN32
Debug((DEBUG_FATAL, "Couldn't restart server: %s", strerror(errno)));
#else
Debug((DEBUG_FATAL, "Couldn't restart server: %s",
strerror(GetLastError())));
#endif
unload_all_modules();
#ifdef _WIN32
@@ -360,9 +353,6 @@ void check_ping(Client *client)
int ping = 0;
ping = client->local->class ? client->local->class->pingfreq : iConf.handshake_timeout;
Debug((DEBUG_DEBUG, "c(%s)=%d p %d a %lld", client->name,
client->status, ping,
(long long)(TStime() - client->local->lasttime)));
/* If ping is less than or equal to the last time we received a command from them */
if (ping > (TStime() - client->local->lasttime))
@@ -386,9 +376,6 @@ void check_ping(Client *client)
ircd_log(LOG_ERROR, "No response from %s, closing link",
get_client_name(client, FALSE));
}
if (IsTLSAcceptHandshake(client))
Debug((DEBUG_DEBUG, "ssl accept handshake timeout: %s (%lld-%lld > %lld)", client->local->sockhost,
(long long)TStime(), (long long)client->local->since, (long long)ping));
ircsnprintf(scratch, sizeof(scratch), "Ping timeout: %lld seconds",
(long long) (TStime() - client->local->lasttime));
exit_client(client, NULL, scratch);
@@ -549,40 +536,19 @@ void fix_timers(void)
list_for_each_entry(client, &lclient_list, lclient_node)
{
if (client->local->since > TStime())
{
Debug((DEBUG_DEBUG, "fix_timers(): %s: client->local->since %ld -> %ld",
client->name, client->local->since, TStime()));
client->local->since = TStime();
}
if (client->local->lasttime > TStime())
{
Debug((DEBUG_DEBUG, "fix_timers(): %s: client->local->lasttime %ld -> %ld",
client->name, client->local->lasttime, TStime()));
client->local->lasttime = TStime();
}
if (client->local->last > TStime())
{
Debug((DEBUG_DEBUG, "fix_timers(): %s: client->local->last %ld -> %ld",
client->name, client->local->last, TStime()));
client->local->last = TStime();
}
/* users */
if (MyUser(client))
{
if (client->local->nextnick > TStime())
{
Debug((DEBUG_DEBUG, "fix_timers(): %s: client->local->nextnick %ld -> %ld",
client->name, client->local->nextnick, TStime()));
client->local->nextnick = TStime();
}
if (client->local->nexttarget > TStime())
{
Debug((DEBUG_DEBUG, "fix_timers(): %s: client->local->nexttarget %ld -> %ld",
client->name, client->local->nexttarget, TStime()));
client->local->nexttarget = TStime();
}
}
}
@@ -611,7 +577,6 @@ void fix_timers(void)
thr->since = TStime();
}
}
Debug((DEBUG_DEBUG, "fix_timers(): removed %d throttling item(s)", cnt));
/* Make sure autoconnect for servers still works (lnk->hold) */
for (lnk = conf_link; lnk; lnk = lnk->next)
@@ -621,7 +586,6 @@ void fix_timers(void)
if (lnk->hold > TStime() + t)
{
lnk->hold = TStime() + (t / 2); /* compromise */
Debug((DEBUG_DEBUG, "fix_timers(): link '%s' hold-time adjusted to %ld", lnk->servername, lnk->hold));
}
}
}
@@ -1243,7 +1207,6 @@ int InitUnrealIRCd(int argc, char *argv[])
fix_timers();
write_pidfile();
Debug((DEBUG_NOTICE, "Server ready..."));
init_throttling();
loop.ircd_booted = 1;
#if defined(HAVE_SETPROCTITLE)
@@ -1366,9 +1329,6 @@ static void open_debugfile(void)
else
# endif
strlcpy(client->name, "FD2-Pipe", sizeof(client->name));
Debug((DEBUG_FATAL,
"Debug: File <%s> Level: %d at %s", client->name,
client->local->port, myctime(time(NULL))));
}
#endif
}
-2
View File
@@ -536,8 +536,6 @@ int fast_badword_replace(ConfigItem_badword *badword, char *line, char *buf, int
int run = 1;
int cleaned = 0;
Debug((DEBUG_NOTICE, "replacing %s -> %s in '%s'", badword->word, replacew, line));
while(run) {
pold = our_strcasestr(pold, badword->word);
if (!pold)
-3
View File
@@ -605,12 +605,9 @@ void exit_client_ex(Client *client, Client *origin, MessageTag *recv_mtags, char
if (client->serv && client->serv->conf)
{
client->serv->conf->refcount--;
Debug((DEBUG_ERROR, "reference count for %s (%s) is now %d",
client->name, client->serv->conf->servername, client->serv->conf->refcount));
if (!client->serv->conf->refcount
&& client->serv->conf->flag.temporary)
{
Debug((DEBUG_ERROR, "deleting temporary block %s", client->serv->conf->servername));
delete_linkblock(client->serv->conf);
client->serv->conf = NULL;
}
-1
View File
@@ -299,7 +299,6 @@ char *Module_Create(char *path_)
char *expectedmodversion = our_mod_version;
unsigned int expectedcompilerversion = our_compiler_version;
long modsys_ver = 0;
Debug((DEBUG_DEBUG, "Attempting to load module from %s", path_));
path = Module_TransformPath(path_);
-1
View File
@@ -43,7 +43,6 @@ MOD_UNLOAD()
static void ident_lookup_failed(Client *client)
{
Debug((DEBUG_NOTICE, "ident_lookup_failed() for %p", client));
ircstats.is_abad++;
if (client->local->authfd != -1)
{
-2
View File
@@ -1335,8 +1335,6 @@ int AllowClient(Client *client, char *username)
static char uhost[HOSTLEN + USERLEN + 3];
static char fullname[HOSTLEN + 1];
Debug((DEBUG_DNS, "ch_cl: check access for %s[%s]", client->name, client->local->sockhost));
if (!check_init(client, sockhost, sizeof(sockhost)))
return 0;
-4
View File
@@ -1406,11 +1406,7 @@ int server_sync(Client *cptr, ConfigItem_link *aconf)
if (!cptr->serv->conf)
cptr->serv->conf = aconf; /* Only set serv->conf to aconf if not set already! Bug #0003913 */
if (incoming)
{
cptr->serv->conf->refcount++;
Debug((DEBUG_ERROR, "reference count for %s (%s) is now %d",
cptr->name, cptr->serv->conf->servername, cptr->serv->conf->refcount));
}
cptr->serv->conf->class->clients++;
cptr->local->class = cptr->serv->conf->class;
RunHook(HOOKTYPE_SERVER_CONNECT, cptr);
-4
View File
@@ -463,7 +463,6 @@ getnick:
continue;
if (nick[0] == '\0')
continue;
Debug((DEBUG_DEBUG, "Got nick: %s", nick));
if (!(modeflags & CHFL_BAN) && !(modeflags & CHFL_EXCEPT) && !(modeflags & CHFL_INVEX))
{
Client *acptr;
@@ -634,7 +633,6 @@ getnick:
}
/* Send out any possible remainder.. */
Debug((DEBUG_DEBUG, "Sending '%li %s :%s' to ", ts, parabuf, parv[parc - 1]));
sendto_server(client, 0, PROTO_SJSBY, recv_mtags, "%s", uid_buf);
sendto_server(client, PROTO_SJSBY, 0, recv_mtags, "%s", uid_sjsby_buf);
@@ -843,12 +841,10 @@ getnick:
case EXSJ_THEYWON:
parax = cm_getparameter(channel, flag);
Debug((DEBUG_DEBUG, "sjoin: they won: '%s'", parax));
Addit(Channelmode_Table[i].flag, parax);
break;
case EXSJ_SAME:
Debug((DEBUG_DEBUG, "sjoin: equal"));
break;
case EXSJ_MERGE:
+2 -3
View File
@@ -97,14 +97,13 @@ CMD_FUNC(cmd_starttls)
send_queued(client);
SetStartTLSHandshake(client);
Debug((DEBUG_DEBUG, "Starting SSL handshake (due to STARTTLS) for %s", client->local->sockhost));
if ((client->local->ssl = SSL_new(ctx)) == NULL)
goto fail;
SetTLS(client);
SSL_set_fd(client->local->ssl, client->local->fd);
SSL_set_nonblocking(client->local->ssl);
if (!ircd_SSL_accept(client, client->local->fd)) {
Debug((DEBUG_DEBUG, "Failed SSL accept handshake in instance 1: %s", client->local->sockhost));
if (!ircd_SSL_accept(client, client->local->fd))
{
SSL_set_shutdown(client->local->ssl, SSL_RECEIVED_SHUTDOWN);
SSL_smart_shutdown(client->local->ssl);
SSL_free(client->local->ssl);
-4
View File
@@ -189,8 +189,6 @@ void parse(Client *cptr, char *buffer, int length)
return;
}
Debug((DEBUG_ERROR, "Parsing: %s (from %s)", buffer, (*cptr->name ? cptr->name : "*")));
if (IsDeadSocket(cptr))
return;
@@ -407,8 +405,6 @@ static void parse2(Client *cptr, Client **fromptr, MessageTag *mtags, int mtags_
sendto_one(from, NULL, ":%s %d %s %s :Unknown command",
me.name, ERR_UNKNOWNCOMMAND,
from->name, ch);
Debug((DEBUG_ERROR, "Unknown (%s) from %s",
ch, get_client_name(cptr, TRUE)));
}
}
ircstats.is_unco++;
-1
View File
@@ -459,7 +459,6 @@ void init_random()
if (fd >= 0)
{
int n = read(fd, &rdat.rnd, sizeof(rdat.rnd));
Debug((DEBUG_INFO, "init_random: read from /dev/urandom returned %d", n));
close(fd);
}
#else
-7
View File
@@ -78,7 +78,6 @@ int dead_socket(Client *to, char *notice)
if (!IsUser(to) && !IsUnknown(to) && !IsClosing(to))
sendto_ops_and_log("Link to server %s (%s) closed: %s",
to->name, to->ip?to->ip:"<no-ip>", notice);
Debug((DEBUG_ERROR, "dead_socket: %s - %s", notice, get_client_name(to, FALSE)));
safe_strdup(to->local->error_str, notice);
return -1;
}
@@ -248,8 +247,6 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick)
Hook *h;
Client *intended_to = to;
Debug((DEBUG_ERROR, "Sending [%s] to %s", msg, to->name));
if (to->direction)
to = to->direction;
if (IsDeadSocket(to))
@@ -259,11 +256,7 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick)
{
/* This is normal when 'to' was being closed (via exit_client
* and close_connection) --Run
* Print the debug message anyway...
*/
Debug((DEBUG_ERROR,
"Local socket %s with negative fd %d... AARGH!", to->name,
to->local->fd));
return;
}
-8
View File
@@ -101,8 +101,6 @@ void report_error(char *text, Client *client)
host = (client) ? get_client_name(client, FALSE) : "";
Debug((DEBUG_ERROR, text, host, STRERROR(errtmp)));
/*
* Get the *real* error from the socket (well try to anyway..).
* This may only work when SO_DEBUG is enabled but its worth the
@@ -152,8 +150,6 @@ void report_baderror(char *text, Client *client)
host = (client) ? get_client_name(client, FALSE) : "";
Debug((DEBUG_ERROR, text, host, STRERROR(errtmp)));
/*
* Get the *real* error from the socket (well try to anyway..).
* This may only work when SO_DEBUG is enabled but its worth the
@@ -932,7 +928,6 @@ refuse_client:
if (ctx)
{
SetTLSAcceptHandshake(client);
Debug((DEBUG_DEBUG, "Starting TLS accept handshake for %s", client->local->sockhost));
if ((client->local->ssl = SSL_new(ctx)) == NULL)
{
goto refuse_client;
@@ -943,7 +938,6 @@ refuse_client:
SSL_set_ex_data(client->local->ssl, ssl_client_index, client);
if (!ircd_SSL_accept(client, fd))
{
Debug((DEBUG_DEBUG, "Failed TLS accept handshake in instance 1: %s", client->local->sockhost));
SSL_set_shutdown(client->local->ssl, SSL_RECEIVED_SHUTDOWN);
SSL_smart_shutdown(client->local->ssl);
SSL_free(client->local->ssl);
@@ -1275,8 +1269,6 @@ int connect_server(ConfigItem_link *aconf, Client *by, struct hostent *hp)
sendto_realops("connect_server() CONTINUED (%s:%d), aconf %p, refcount: %d, TEMP: %s",
__FILE__, __LINE__, aconf, aconf->refcount, aconf->flag.temporary ? "YES" : "NO");
#endif
Debug((DEBUG_ERROR, "reference count for %s (%s) is now %d",
client->name, client->serv->conf->servername, client->serv->conf->refcount));
if (by && IsUser(by))
strlcpy(client->serv->by, by->name, sizeof(client->serv->by));
else
-1
View File
@@ -140,7 +140,6 @@ char *inetntop(int af, const void *in, char *out, size_t size)
if (*(op - 1) == ':')
*op++ = '0';
*op = '\0';
Debug((DEBUG_DNS, "Expanding `%s' -> `%s'", tmp, out));
}
return out;
}
-3
View File
@@ -702,11 +702,9 @@ void ircd_SSL_client_handshake(int fd, int revents, void *data)
--OpenFiles;
return;
case 0:
Debug((DEBUG_DEBUG, "SetTLSConnectHandshake(%s)", get_client_name(client, TRUE)));
SetTLSConnectHandshake(client);
return;
case 1:
Debug((DEBUG_DEBUG, "SSL_init_finished should finish this job (%s)", get_client_name(client, TRUE)));
return;
default:
return;
@@ -986,7 +984,6 @@ int client_starttls(Client *client)
if (ircd_SSL_connect(client, client->local->fd) < 0)
{
Debug((DEBUG_DEBUG, "Failed SSL connect handshake in instance 1: %s", client->name));
SSL_set_shutdown(client->local->ssl, SSL_RECEIVED_SHUTDOWN);
SSL_smart_shutdown(client->local->ssl);
SSL_free(client->local->ssl);
-1
View File
@@ -321,7 +321,6 @@ static void url_socket_pollcb(int fd, int revents, void *data)
static int url_socket_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
{
Debug((DEBUG_DEBUG, "url_socket_cb: %d (%s)", (int)s, (what == CURL_POLL_REMOVE)?"remove":"add-or-modify"));
if (what == CURL_POLL_REMOVE)
{
fd_close(s);