summaryrefslogtreecommitdiff
path: root/src/network.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-01-13 23:54:35 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2019-01-13 23:56:54 -0500
commitb2ee667a3dee507a0eb3897a703daef269f03ff7 (patch)
tree60807d0fa06938ed9c833e4b634191893a69cc1c /src/network.c
parent9b7a32ea70e0f955489b21a64b416cf167558595 (diff)
downloadlighttpd-git-b2ee667a3dee507a0eb3897a703daef269f03ff7.tar.gz
[core] move winsock init to network_init()
Diffstat (limited to 'src/network.c')
-rw-r--r--src/network.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/network.c b/src/network.c
index 09d66aaf..4b5a430a 100644
--- a/src/network.c
+++ b/src/network.c
@@ -132,21 +132,6 @@ static int network_server_init(server *srv, buffer *host_token, size_t sidx, int
int family = 0;
int set_v6only = 0;
-#ifdef __WIN32
- int err;
- WORD wVersionRequested;
- WSADATA wsaData;
-
- wVersionRequested = MAKEWORD( 2, 2 );
-
- err = WSAStartup( wVersionRequested, &wsaData );
- if ( err != 0 ) {
- /* Tell the user that we could not find a usable */
- /* WinSock DLL. */
- return -1;
- }
-#endif
-
if (buffer_string_is_empty(host_token)) {
log_error_write(srv, __FILE__, __LINE__, "s", "value of $SERVER[\"socket\"] must not be empty");
return -1;
@@ -387,6 +372,16 @@ int network_close(server *srv) {
int network_init(server *srv, int stdin_fd) {
size_t i;
+
+ #ifdef __WIN32
+ WSADATA wsaData;
+ WORD wVersionRequested = MAKEWORD(2, 2);
+ if (0 != WSAStartup(wVersionRequested, &wsaData)) {
+ /* Tell the user that we could not find a usable WinSock DLL */
+ return -1;
+ }
+ #endif
+
if (0 != network_write_init(srv)) return -1;
{