ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/restart.c
(Generate patch)

Comparing:
ircd-hybrid/src/restart.c (file contents), Revision 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid/trunk/src/restart.c (file contents), Revision 6527 by michael, Fri Sep 11 16:33:29 2015 UTC

# Line 1 | Line 1
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-2015 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
# Line 16 | Line 15
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
20 < *
21 < *  $Id: restart.c,v 7.32 2005/09/19 06:15:21 metalrock Exp $
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  
40   void
41 < restart(const char *mesg)
41 > server_die(const char *message, int action)
42   {
43 <  static int was_here = 0; /* redundant due to restarting flag below */
43 >  char buffer[IRCD_BUFSIZE] = "";
44 >  dlink_node *node = NULL;
45 >  static int was_here = 0;
46  
47 <  if (was_here)
47 >  if (action == SERVER_RESTART && was_here++)
48      abort();
44 –  was_here = 1;
45 –
46 –  server_die(mesg, YES);
47 – }
48 –
49 – void
50 – server_die(const char *mesg, int rboot)
51 – {
52 –  char buffer[IRCD_BUFSIZE];
53 –  dlink_node *ptr = NULL;
54 –  struct Client *target_p = NULL;
49  
50 <  if (EmptyString(mesg))
50 >  if (EmptyString(message))
51      snprintf(buffer, sizeof(buffer), "Server %s",
52 <             rboot ? "Restarting" : "Terminating");
52 >             action == SERVER_RESTART ? "Restarting" : "Terminating");
53    else
54      snprintf(buffer, sizeof(buffer), "Server %s: %s",
55 <             rboot ? "Restarting" : "Terminating", mesg);
55 >             action == SERVER_RESTART ? "Restarting" : "Terminating", message);
56  
57 <  DLINK_FOREACH(ptr, local_client_list.head)
58 <  {
65 <    target_p = ptr->data;
57 >  DLINK_FOREACH(node, local_client_list.head)
58 >    sendto_one_notice(node->data, &me, ":%s", buffer);
59  
60 <    sendto_one(target_p, ":%s NOTICE %s :%s",
68 <               me.name, target_p->name, buffer);
69 <  }
60 >  sendto_server(NULL, 0, 0, ":%s ERROR :%s", me.id, buffer);
61  
62 <  DLINK_FOREACH(ptr, serv_list.head)
72 <  {
73 <    target_p = ptr->data;
74 <
75 <    sendto_one(target_p, ":%s ERROR :%s", me.name, buffer);
76 <  }
62 >  ilog(LOG_TYPE_IRCD, "%s", buffer);
63  
64 <  ilog(L_NOTICE, buffer);
64 >  save_all_databases(NULL);
65  
66    send_queued_all();
67    close_fds(NULL);
68  
69    unlink(pidFileName);
70  
71 <  if (rboot)
71 >  if (action == SERVER_RESTART)
72    {
73      execv(SPATH, myargv);
74 <    exit(1);
74 >    exit(EXIT_FAILURE);
75    }
76    else
77 <    exit(0);
77 >    exit(EXIT_SUCCESS);
78   }

Comparing:
ircd-hybrid/src/restart.c (property svn:keywords), Revision 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid/trunk/src/restart.c (property svn:keywords), Revision 6527 by michael, Fri Sep 11 16:33:29 2015 UTC

# Line 1 | Line 1
1 < "Id Revision"
1 > Id Revision

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)