Commit 2beef6d5 authored by unknown's avatar unknown

Fix Bug #19044 IM aborts on exit

On windows IM aborted on assert once one
stoppped it. The reason is that we didn't
close the sockets on windows and therefore,
the listener thread wasn't able to finish.
This happened because we used close() call
for it. While on windows one should use
closesocket().
On other platfroms we have appropriate defines
for closesocket(), so this is the function which
should be used.


server-tools/instance-manager/listener.cc:
  close -> closesocket
parent ffc103ca
...@@ -188,7 +188,7 @@ void Listener_thread::run() ...@@ -188,7 +188,7 @@ void Listener_thread::run()
else else
{ {
shutdown(client_fd, SHUT_RDWR); shutdown(client_fd, SHUT_RDWR);
close(client_fd); closesocket(client_fd);
} }
} }
} }
...@@ -200,7 +200,7 @@ void Listener_thread::run() ...@@ -200,7 +200,7 @@ void Listener_thread::run()
log_info("Listener_thread::run(): shutdown requested, exiting..."); log_info("Listener_thread::run(): shutdown requested, exiting...");
for (i= 0; i < num_sockets; i++) for (i= 0; i < num_sockets; i++)
close(sockets[i]); closesocket(sockets[i]);
#ifndef __WIN__ #ifndef __WIN__
unlink(unix_socket_address.sun_path); unlink(unix_socket_address.sun_path);
...@@ -213,7 +213,7 @@ void Listener_thread::run() ...@@ -213,7 +213,7 @@ void Listener_thread::run()
err: err:
// we have to close the ip sockets in case of error // we have to close the ip sockets in case of error
for (i= 0; i < num_sockets; i++) for (i= 0; i < num_sockets; i++)
close(sockets[i]); closesocket(sockets[i]);
thread_registry.unregister_thread(&thread_info); thread_registry.unregister_thread(&thread_info);
thread_registry.request_shutdown(); thread_registry.request_shutdown();
...@@ -260,7 +260,7 @@ int Listener_thread::create_tcp_socket() ...@@ -260,7 +260,7 @@ int Listener_thread::create_tcp_socket()
{ {
log_error("Listener_thread::run(): bind(ip socket) failed, '%s'", log_error("Listener_thread::run(): bind(ip socket) failed, '%s'",
strerror(errno)); strerror(errno));
close(ip_socket); closesocket(ip_socket);
return -1; return -1;
} }
...@@ -268,7 +268,7 @@ int Listener_thread::create_tcp_socket() ...@@ -268,7 +268,7 @@ int Listener_thread::create_tcp_socket()
{ {
log_error("Listener_thread::run(): listen(ip socket) failed, %s", log_error("Listener_thread::run(): listen(ip socket) failed, %s",
strerror(errno)); strerror(errno));
close(ip_socket); closesocket(ip_socket);
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment