diff main.c @ 489:ba48840b8525

Move network initialization/shutdown flag checking to network module.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 27 May 2012 03:31:35 +0300
parents d48327519b17
children 56689f94e827
line wrap: on
line diff
--- a/main.c	Sat May 26 17:49:06 2012 +0300
+++ b/main.c	Sun May 27 03:31:35 2012 +0300
@@ -1345,7 +1345,6 @@
     BOOL argsOK, isError = FALSE,
         exitProg = FALSE,
         colorSet = FALSE,
-        networkInit = FALSE,
         insertMode = TRUE,
         firstUpdate = TRUE;
     time_t prevTime;
@@ -1482,8 +1481,6 @@
         THERR("Could not initialize network subsystem.\n");
         goto err_exit;
     }
-    else
-        networkInit = TRUE;
 
     // Initialize curses windowing
     if (!optDaemon && !nnwin_init(SET_DELAY))
@@ -2003,8 +2000,6 @@
     for (index = 0; index <= SET_MAX_HISTORY; index++)
         nn_editbuf_free(histBuf[index]);
 
-    nnwin_shutdown();
-
 #ifdef __WIN32
     if (errorMessages)
     {
@@ -2015,6 +2010,7 @@
     }
 #endif
 
+    nnwin_shutdown();
 
 #ifndef __WIN32
     if (errorMessages)
@@ -2022,11 +2018,8 @@
 #endif
 
     th_free(optUserNameEnc);
-
     nn_conn_close(conn);
-
-    if (networkInit)
-        nn_network_close();
+    nn_network_close();
 
     THMSG(1, "Connection terminated.\n");