fixed renameAccount function (merging mode)
[NeonServV5.git] / src / ClientSocket.c
index 9112b850e942a828ea1250260feacc1944cdd898..eb11d88fc131558ff1bb698f883c37bd91144188 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU General Public License 
  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
  */
-
+#include "main.h"
 #include "ClientSocket.h"
 #include "IRCParser.h"
 #include "UserNode.h"
@@ -222,6 +222,8 @@ static IOHANDLER_CALLBACK(socket_callback) {
     #ifdef HAVE_THREADS
     unsigned int tid;
     #endif
+    if(process_state.running == 0)
+        return; //just ignore the event (shutdown sequence)
     switch(event->type) {
     case IOEVENT_CONNECTED:
         client->flags |= SOCKET_FLAG_CONNECTED;
@@ -296,7 +298,8 @@ void free_sockets(int close_only) {
         } else
             destroy_socket(client);
     }
-    if(!close_only)
+    if(!close_only) {
         free(sockets);
-    sockets = NULL;
+        sockets = NULL;
+    }
 }