Mercurial > hg > nnchat
diff network.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 | bbe05594f29d |
children | 9141f13be70c |
line wrap: on
line diff
--- a/network.c Sat May 26 17:49:06 2012 +0300 +++ b/network.c Sun May 27 03:31:35 2012 +0300 @@ -6,6 +6,7 @@ #include "network.h" #include <errno.h> +static BOOL nn_network_inited = FALSE; static const char *nn_proxy_types[] = { @@ -461,15 +462,22 @@ return FALSE; } #endif + + nn_network_inited = TRUE; return TRUE; } void nn_network_close(void) { + if (nn_network_inited) + { #ifdef __WIN32 - WSACleanup(); + WSACleanup(); #endif + } + + nn_network_inited = FALSE; }