Debug stacks will now be printed on Ctrl-C. Also client properly quits on Ctrl-C.
authorPerttu Ahola <celeron55@gmail.com>
Wed, 16 Feb 2011 20:54:07 +0000 (22:54 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Wed, 16 Feb 2011 20:54:07 +0000 (22:54 +0200)
src/main.cpp
src/porting.cpp

index 503439d104a8618cbeb1ef17b9c190c09884b364..88a258dce27d5fea9869185ea0e37f11ab90bdc8 100644 (file)
@@ -1874,7 +1874,7 @@ int main(int argc, char *argv[])
        /*\r
                Menu-game loop\r
        */\r
-       while(g_device->run())\r
+       while(g_device->run() && kill == false)\r
        {\r
        \r
        // This is used for catching disconnects\r
@@ -1886,7 +1886,7 @@ int main(int argc, char *argv[])
 \r
                Loop quits when menu returns proper parameters.\r
        */\r
-       for(;;)\r
+       while(kill == false)\r
        {\r
                // Cursor can be non-visible when coming from the game\r
                device->getCursorControl()->setVisible(true);\r
@@ -2179,7 +2179,7 @@ int main(int argc, char *argv[])
        // NOTE: So we have to use getTime() and call run()s between them\r
        u32 lasttime = device->getTimer()->getTime();\r
 \r
-       while(device->run())\r
+       while(device->run() && kill == false)\r
        {\r
                if(g_disconnect_requested)\r
                {\r
index 50605587dc1950c5315811d5320cb6480225fa37..97b02823668d24545e7f34edd4df4fa359b943cc 100644 (file)
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "porting.h"
 #include "config.h"
+#include "debug.h"
 
 namespace porting
 {
@@ -47,8 +48,13 @@ void sigint_handler(int sig)
 {
        if(g_killed == false)
        {
-               dstream<<DTIME<<"sigint_handler(): "
+               dstream<<DTIME<<"INFO: sigint_handler(): "
                                <<"Ctrl-C pressed, shutting down."<<std::endl;
+               
+               dstream<<DTIME<<"INFO: siging_handler(): "
+                               <<"Printing debug stacks"<<std::endl;
+               debug_stacks_print();
+
                g_killed = true;
        }
        else