ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/restart.c
Revision: 9002
Committed: Sat May 25 23:13:57 2019 UTC (6 years, 3 months ago) by michael
Content type: text/x-csrc
File size: 2081 byte(s)
Log Message:
- Actually remove send_queued_all() as it is no longer needed

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2019 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
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
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 "list.h"
29 #include "restart.h"
30 #include "fdlist.h"
31 #include "ircd.h"
32 #include "irc_string.h"
33 #include "send.h"
34 #include "log.h"
35 #include "client.h"
36 #include "memory.h"
37 #include "conf_db.h"
38
39
40 void
41 server_die(const char *message, bool restart)
42 {
43 char buffer[IRCD_BUFSIZE] = "";
44 dlink_node *node;
45
46 if (restart == true)
47 {
48 static bool was_here = false;
49 if (was_here == false)
50 was_here = true;
51 else
52 abort();
53 }
54
55 if (EmptyString(message))
56 snprintf(buffer, sizeof(buffer), "Server %s",
57 restart ? "Restarting" : "Terminating");
58 else
59 snprintf(buffer, sizeof(buffer), "Server %s: %s",
60 restart ? "Restarting" : "Terminating", message);
61
62 DLINK_FOREACH(node, local_client_list.head)
63 sendto_one_notice(node->data, &me, ":%s", buffer);
64
65 sendto_server(NULL, 0, 0, ":%s ERROR :%s", me.id, buffer);
66
67 ilog(LOG_TYPE_IRCD, "%s", buffer);
68
69 save_all_databases(NULL);
70
71 close_fds();
72
73 unlink(pidFileName);
74
75 if (restart == true)
76 {
77 execv(SPATH, myargv);
78 exit(EXIT_FAILURE);
79 }
80 else
81 exit(EXIT_SUCCESS);
82 }

Properties

Name Value
svn:eol-style native
svn:keywords Id