]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Added support for /RESTART (currently has a bug, do not use)
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 9 May 2004 13:14:32 +0000 (13:14 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 9 May 2004 13:14:32 +0000 (13:14 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@800 e03df62e-2008-0410-955e-edbf42e46eb7

src/InspIRCd.layout
src/channels.cpp
src/commands.cpp
src/inspircd.cpp
src/modules.cpp
src/xline.cpp

index 031b101b53a14182301ca14ccf8b0fdef910ea52..6cfb8dd38958b3af5992783228ebefbce944a361 100644 (file)
@@ -1,5 +1,5 @@
 [Editors]
-Focused=-1
+Focused=43
 Order=2,4,6,3,7,25,5,24,39,42,43,-1,1,46,0,49
 
 [Editor_0]
@@ -14,16 +14,16 @@ LeftChar=1
 Open=1
 Top=0
 CursorCol=1
-CursorRow=1
-TopLine=1
+CursorRow=99
+TopLine=73
 LeftChar=1
 
 [Editor_2]
 Open=1
 Top=0
-CursorCol=18
-CursorRow=354
-TopLine=110
+CursorCol=21
+CursorRow=489
+TopLine=437
 LeftChar=1
 
 [Editor_3]
@@ -37,9 +37,9 @@ LeftChar=1
 [Editor_4]
 Open=1
 Top=0
-CursorCol=21
-CursorRow=441
-TopLine=407
+CursorCol=12
+CursorRow=78
+TopLine=78
 LeftChar=1
 
 [Editor_5]
@@ -71,7 +71,7 @@ Open=1
 Top=0
 CursorCol=50
 CursorRow=31
-TopLine=7
+TopLine=1
 LeftChar=1
 
 [Editor_9]
@@ -79,15 +79,15 @@ Open=1
 Top=0
 CursorCol=17
 CursorRow=65
-TopLine=26
+TopLine=1
 LeftChar=1
 
 [Editor_10]
 Open=1
 Top=0
-CursorCol=13
-CursorRow=62
-TopLine=49
+CursorCol=3
+CursorRow=29
+TopLine=70
 LeftChar=1
 
 [Editor_11]
@@ -149,8 +149,8 @@ LeftChar=1
 [Editor_18]
 Open=1
 Top=0
-CursorCol=69
-CursorRow=31
+CursorCol=6
+CursorRow=20
 TopLine=1
 LeftChar=1
 
@@ -205,8 +205,8 @@ LeftChar=1
 Open=1
 Top=0
 CursorCol=1
-CursorRow=134
-TopLine=116
+CursorRow=77
+TopLine=77
 LeftChar=1
 [Editor_26]
 Open=1
@@ -254,8 +254,8 @@ LeftChar=1
 Open=1
 Top=0
 CursorCol=3
-CursorRow=50
-TopLine=52
+CursorRow=57
+TopLine=28
 LeftChar=1
 [Editor_33]
 Open=1
@@ -274,9 +274,9 @@ LeftChar=1
 [Editor_35]
 Open=1
 Top=0
-CursorCol=1
-CursorRow=29
-TopLine=1
+CursorCol=2
+CursorRow=51
+TopLine=24
 LeftChar=1
 [Editor_36]
 Open=1
@@ -329,10 +329,10 @@ TopLine=1232
 LeftChar=1
 [Editor_43]
 Open=1
-Top=0
-CursorCol=1
-CursorRow=1405
-TopLine=1364
+Top=1
+CursorCol=10
+CursorRow=285
+TopLine=249
 LeftChar=1
 [Editor_44]
 Open=1
@@ -351,23 +351,23 @@ LeftChar=1
 [Editor_46]
 Open=1
 Top=0
-CursorCol=13
-CursorRow=154
-TopLine=1
+CursorCol=1
+CursorRow=77
+TopLine=24
 LeftChar=1
 [Editor_47]
 Open=1
-Top=1
-CursorCol=138
-CursorRow=103
-TopLine=96
+Top=0
+CursorCol=1
+CursorRow=157
+TopLine=4
 LeftChar=1
 [Editor_48]
 Open=1
 Top=0
 CursorCol=11
 CursorRow=82
-TopLine=53
+TopLine=2
 LeftChar=1
 [Editor_49]
 Open=1
@@ -381,33 +381,33 @@ Open=1
 Top=0
 CursorCol=1
 CursorRow=211
-TopLine=203
+TopLine=167
 LeftChar=1
 [Editor_51]
 Open=1
 Top=0
 CursorCol=12
 CursorRow=57
-TopLine=28
+TopLine=19
 LeftChar=1
 [Editor_52]
 Open=1
 Top=0
 CursorCol=2
 CursorRow=39
-TopLine=4
+TopLine=43
 LeftChar=1
 [Editor_53]
 Open=1
 Top=0
 CursorCol=1
 CursorRow=58
-TopLine=16
+TopLine=1
 LeftChar=1
 [Editor_54]
 Open=1
 Top=0
 CursorCol=1
 CursorRow=29
-TopLine=2
+TopLine=14
 LeftChar=1
index 86df2124a9c5daadba540a97a84cd136a931556b..1def64fd8bcfa1ee656b682e12c7041324c2de9e 100644 (file)
@@ -74,7 +74,6 @@ extern time_t nb_start;
 extern std::vector<int> fd_reap;
 extern std::vector<std::string> module_names;
 
-extern char bannerBuffer[MAXBUF];
 extern int boundPortCount;
 extern int portCount;
 extern int UDPportCount;
index c7b0bc6a1c2874144b6bdfa2f2c56265533e8e6b..13487e6958ae376c81955bea34c55786031c2cff 100644 (file)
@@ -71,10 +71,12 @@ extern int NetBufferSize;
 extern int MaxWhoResults;
 extern time_t nb_start;
 
+extern bool nofork;
+
 extern std::vector<int> fd_reap;
 extern std::vector<std::string> module_names;
 
-extern char bannerBuffer[MAXBUF];
+extern char MyExecutable[1024];
 extern int boundPortCount;
 extern int portCount;
 extern int UDPportCount;
@@ -259,13 +261,44 @@ void handle_die(char **parameters, int pcnt, userrec *user)
 
 void handle_restart(char **parameters, int pcnt, userrec *user)
 {
-       log(DEBUG,"restart: %s",user->nick);
+       char restart[1024];
+       char *argv[32];
+       log(DEFAULT,"Restart: %s",user->nick);
        if (!strcmp(parameters[0],restartpass))
        {
-               WriteOpers("*** RESTART command from %s!%s@%s, Pretending to restart till this is finished :D",user->nick,user->ident,user->host);
-               sleep(DieDelay);
-               Exit(ERROR);
-               /* Will finish this later when i can be arsed :) */
+               WriteOpers("*** RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
+
+               argv[0] = MyExecutable;
+               argv[1] = "-wait";
+               if (nofork)
+               {
+                       argv[2] = "-nofork";
+               }
+               else
+               {
+                       argv[2] = NULL;
+               }
+               argv[3] = NULL;
+               
+               // close ALL file descriptors
+               send_error("Server restarting.");
+               sleep(1);
+               for (int i = 0; i < 65536; i++)
+               {
+                       int on = 0;
+                       struct linger linger = { 0 };
+                       setsockopt(i, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on));
+                       linger.l_onoff = 1;
+                       linger.l_linger = 0;
+                       setsockopt(i, SOL_SOCKET, SO_LINGER, (const char*)&linger,sizeof(linger));
+                       Blocking(i);
+                       close(i);
+               }
+               sleep(5);
+               
+               execv(MyExecutable,argv);
+
+               exit(0);
        }
        else
        {
index 6a6359b6e7a35e4902663f23e3b89a4947c1ae6a..48460b3697b77c0915bed136b48dcc514315ceb2 100644 (file)
@@ -174,7 +174,7 @@ address_cache IP;
 ClassVector Classes;
 
 struct linger linger = { 0 };
-char bannerBuffer[MAXBUF];
+char MyExecutable[1024];
 int boundPortCount = 0;
 int portCount = 0, UDPportCount = 0, ports[MAXSOCKS];
 int defaultRoute = 0;
@@ -2000,7 +2000,7 @@ void Error(int status)
 }
 
 
-int main(int argc, char *argv[])
+int main(int argc, char **argv)
 {
        Start();
        srand(time(NULL));
@@ -2013,10 +2013,18 @@ int main(int argc, char *argv[])
                Exit(ERROR);
        }
        if (argc > 1) {
-               if (!strcmp(argv[1],"-nofork")) {
-                       nofork = true;
+               for (int i = 1; i < argc; i++)
+               {
+                       if (!strcmp(argv[i],"-nofork")) {
+                               nofork = true;
+                       }
+                       if (!strcmp(argv[i],"-wait")) {
+                               sleep(6);
+                       }
                }
        }
+       strcpy(MyExecutable,argv[0]);
+       
        if (InspIRCd() == ERROR)
        {
                log(DEBUG,"main: daemon function bailed");
@@ -3174,8 +3182,14 @@ int InspIRCd(void)
                                log(DEBUG,"InspIRCd: startup: binding '%s:%s' is default server route",Addr,configToken);
                        }
                        me[count3] = new serverrec(ServerName,100L,false);
-                       me[count3]->CreateListener(Addr,atoi(configToken));
-                       count3++;
+                       if (!me[count3]->CreateListener(Addr,atoi(configToken)))
+                       {
+                               log(DEFAULT,"Error! Failed to bind port %d",atoi(configToken));
+                       }
+                       else
+                       {
+                               count3++;
+                       }
                }
                else
                {
index 73f3ba69a1403c371fbe12d089b18366e998e2c4..311cee22dac2e487247205556c592394066cc09c 100644 (file)
@@ -75,7 +75,6 @@ extern time_t nb_start;
 extern std::vector<int> fd_reap;
 extern std::vector<std::string> module_names;
 
-extern char bannerBuffer[MAXBUF];
 extern int boundPortCount;
 extern int portCount;
 extern int UDPportCount;
index 9e756abe58cbcfa53d9f985033562b98323ab5ba..734c27976da265ff939510f10cc0a57b48886ab0 100644 (file)
@@ -74,7 +74,6 @@ extern time_t nb_start;
 extern std::vector<int> fd_reap;
 extern std::vector<std::string> module_names;
 
-extern char bannerBuffer[MAXBUF];
 extern int boundPortCount;
 extern int portCount;
 extern int UDPportCount;