mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge alik.:/mnt/raid/alik/MySQL/devel/5.0-rt
into alik.:/mnt/raid/alik/MySQL/devel/5.1-rt-merged BitKeeper/etc/collapsed: auto-union mysql-test/r/im_daemon_life_cycle.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/im_daemon_life_cycle.imtest: Auto merged mysql-test/t/sp.test: Auto merged server-tools/instance-manager/instance.cc: Auto merged server-tools/instance-manager/listener.cc: Auto merged sql/mysql_priv.h: Auto merged sql/sp.cc: Auto merged sql/sql_acl.cc: Auto merged mysql-test/lib/mtr_process.pl: Manually merged. mysql-test/mysql-test-run.pl: Manually merged.
This commit is contained in:
@ -38,6 +38,27 @@
|
||||
#include "thread_registry.h"
|
||||
|
||||
|
||||
static void set_non_blocking(int socket)
|
||||
{
|
||||
#ifndef __WIN__
|
||||
int flags= fcntl(socket, F_GETFL, 0);
|
||||
fcntl(socket, F_SETFL, flags | O_NONBLOCK);
|
||||
#else
|
||||
u_long arg= 1;
|
||||
ioctlsocket(socket, FIONBIO, &arg);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void set_no_inherit(int socket)
|
||||
{
|
||||
#ifndef __WIN__
|
||||
int flags= fcntl(socket, F_GETFD, 0);
|
||||
fcntl(socket, F_SETFD, flags | FD_CLOEXEC);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Listener_thread - incapsulates listening functionality
|
||||
*/
|
||||
@ -158,6 +179,8 @@ void Listener_thread::run()
|
||||
/* accept may return -1 (failure or spurious wakeup) */
|
||||
if (client_fd >= 0) // connection established
|
||||
{
|
||||
set_no_inherit(client_fd);
|
||||
|
||||
Vio *vio= vio_new(client_fd, socket_index == 0 ?
|
||||
VIO_TYPE_SOCKET : VIO_TYPE_TCPIP,
|
||||
socket_index == 0 ? 1 : 0);
|
||||
@ -199,25 +222,6 @@ err:
|
||||
return;
|
||||
}
|
||||
|
||||
void set_non_blocking(int socket)
|
||||
{
|
||||
#ifndef __WIN__
|
||||
int flags= fcntl(socket, F_GETFL, 0);
|
||||
fcntl(socket, F_SETFL, flags | O_NONBLOCK);
|
||||
#else
|
||||
u_long arg= 1;
|
||||
ioctlsocket(socket, FIONBIO, &arg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_no_inherit(int socket)
|
||||
{
|
||||
#ifndef __WIN__
|
||||
int flags= fcntl(socket, F_GETFD, 0);
|
||||
fcntl(socket, F_SETFD, flags | FD_CLOEXEC);
|
||||
#endif
|
||||
}
|
||||
|
||||
int Listener_thread::create_tcp_socket()
|
||||
{
|
||||
/* value to be set by setsockopt */
|
||||
|
Reference in New Issue
Block a user