Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Re: Terminal left in wrong state when quitting due to game
Home

[Freeciv-Dev] Re: Terminal left in wrong state when quitting due to game

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: Petr Baudis <pasky@xxxxxxxxxxx>, bugs@xxxxxxxxxxxxxxxxxxx, Andreas Kemnade <akemnade@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Terminal left in wrong state when quitting due to gameover (PR#1077)
From: Thue <thue@xxxxxxx>
Date: Thu, 6 Dec 2001 20:51:18 +0100

I don't think rl_deprep_terminal() is the intended way to reset the 
terminal. rl_callback_handler_remove() is, as far as I can read from 
the docs. (New patch attached)

Also

-It seems the metaserver shutdown command is executed even if it was 
not initialized. I don't think the #ifdef GENERATING_MAC'ed code is 
prepared for this.
-my_shutdown_network() (only does something for win32) was called when 
exiting from srv_main(), but not when using quit_game(). I put it into 
close_connections_and_socket() which is called from quit_game(), is 
this correct? (This question is for the win32 maintainer).

I think we need to also inspect all the other exit()'s in the server. 
But I didn't include that in this patch.

Please CC me, I am not on freeciv-dev.

-Thue

-----------------------
Hi,

  when the game is over and server exits (at least when it was just an
autogame), the terminal is left in noecho state, so one has to type 
'stty sane'
everytime. The attached patch restores terminal correctly. There is a 
question,
how to quit the server. It would be maybe most correct to do it via
quit_game(), like in the rest of server code, otherwise we will end up 
with
things like broken terminal. Or add close_connections_and_socket() call
minimally, to shutdown readline correctly.

-- 

                                Petr "Pasky" Baudis

UN*X programmer, UN*X administrator, hobbies = IPv6, IRC
Real Users hate Real Programmers.
Public PGP key, geekcode and stuff: http://pasky.ji.cz/~pasky/

diff -ru freeciv-/server/sernet.c freeciv/server/sernet.c
--- freeciv-/server/sernet.c    Wed Sep 12 10:39:38 2001
+++ freeciv/server/sernet.c     Sun Nov 25 14:36:12 2001
@@ -200,6 +200,7 @@
     write_history(history_file);
     history_truncate_file(history_file, HISTORY_LENGTH);
   }
+  rl_deprep_terminal();
 #endif
 }
 
diff -ru freeciv-/server/srv_main.c freeciv/server/srv_main.c
--- freeciv-/server/srv_main.c  Thu Oct 18 18:45:34 2001
+++ freeciv/server/srv_main.c   Sun Nov 25 14:44:49 2001
@@ -1973,17 +1973,21 @@
   report_scores(1);
   show_map_to_all();
   notify_player(0, _("Game: The game is over..."));
   gamelog(GAMELOG_GENO, "The game is over!");
   save_game_auto();
 
   while (server_state == GAME_OVER_STATE) {
     force_end_of_sniff = 0;
     sniff_packets();
   }

+  quit_game(NULL);
+  
+/*
   server_close_udp();
 
   my_shutdown_network();
+ */
 
   return;
 }

Attachment: diff
Description: Text Data


[Prev in Thread] Current Thread [Next in Thread]