| 1 |
|
/* |
| 2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 3 |
< |
* restart.c: Functions to allow the ircd to restart. |
| 2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (C) 2002 by the past and present ircd coders, and others. |
| 4 |
> |
* Copyright (c) 1997-2014 ircd-hybrid development team |
| 5 |
|
* |
| 6 |
|
* This program is free software; you can redistribute it and/or modify |
| 7 |
|
* it under the terms of the GNU General Public License as published by |
| 17 |
|
* along with this program; if not, write to the Free Software |
| 18 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 19 |
|
* USA |
| 20 |
< |
* |
| 21 |
< |
* $Id$ |
| 20 |
> |
*/ |
| 21 |
> |
|
| 22 |
> |
/*! \file restart.c |
| 23 |
> |
* \brief Functions to allow the ircd to restart. |
| 24 |
> |
* \version $Id$ |
| 25 |
|
*/ |
| 26 |
|
|
| 27 |
|
#include "stdinc.h" |
| 28 |
< |
#include "tools.h" |
| 28 |
> |
#include "list.h" |
| 29 |
|
#include "restart.h" |
| 28 |
– |
#include "common.h" |
| 30 |
|
#include "fdlist.h" |
| 31 |
|
#include "ircd.h" |
| 32 |
|
#include "irc_string.h" |
| 33 |
|
#include "send.h" |
| 34 |
< |
#include "s_log.h" |
| 35 |
< |
#include "client.h" /* for UMODE_ALL */ |
| 34 |
> |
#include "log.h" |
| 35 |
> |
#include "client.h" |
| 36 |
|
#include "memory.h" |
| 37 |
+ |
#include "conf_db.h" |
| 38 |
|
|
| 39 |
|
void |
| 40 |
|
restart(const char *mesg) |
| 41 |
|
{ |
| 42 |
|
static int was_here = 0; /* redundant due to restarting flag below */ |
| 43 |
|
|
| 44 |
< |
if (was_here) |
| 44 |
> |
if (was_here++) |
| 45 |
|
abort(); |
| 44 |
– |
was_here = 1; |
| 46 |
|
|
| 47 |
< |
server_die(mesg, YES); |
| 47 |
> |
server_die(mesg, 1); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
void |
| 53 |
|
char buffer[IRCD_BUFSIZE]; |
| 54 |
|
dlink_node *ptr = NULL; |
| 55 |
|
struct Client *target_p = NULL; |
| 56 |
+ |
static int was_here = 0; |
| 57 |
+ |
|
| 58 |
+ |
if (rboot && was_here++) |
| 59 |
+ |
abort(); |
| 60 |
|
|
| 61 |
|
if (EmptyString(mesg)) |
| 62 |
|
snprintf(buffer, sizeof(buffer), "Server %s", |
| 80 |
|
sendto_one(target_p, ":%s ERROR :%s", me.name, buffer); |
| 81 |
|
} |
| 82 |
|
|
| 83 |
< |
ilog(L_NOTICE, buffer); |
| 83 |
> |
ilog(LOG_TYPE_IRCD, "%s", buffer); |
| 84 |
> |
|
| 85 |
> |
save_all_databases(NULL); |
| 86 |
|
|
| 87 |
|
send_queued_all(); |
| 88 |
|
close_fds(NULL); |