forked from enlightenment/efl
Ecore_Conn: Enable CLOEXEC by default.
This flag should be enabled by default in order to avoid socket leaks.
This commit is contained in:
parent
97f6803be1
commit
45a767632d
|
@ -634,7 +634,6 @@ _remote_server_create(void)
|
||||||
|
|
||||||
{
|
{
|
||||||
Eo *inner_server = efl_net_server_simple_inner_server_get(_remote_server);
|
Eo *inner_server = efl_net_server_simple_inner_server_get(_remote_server);
|
||||||
efl_net_server_fd_close_on_exec_set(inner_server, EINA_TRUE);
|
|
||||||
efl_net_server_fd_reuse_address_set(inner_server, EINA_TRUE);
|
efl_net_server_fd_reuse_address_set(inner_server, EINA_TRUE);
|
||||||
}
|
}
|
||||||
efl_event_callback_add(_remote_server, EFL_NET_SERVER_EVENT_CLIENT_ADD, _client_add, NULL);
|
efl_event_callback_add(_remote_server, EFL_NET_SERVER_EVENT_CLIENT_ADD, _client_add, NULL);
|
||||||
|
|
|
@ -652,7 +652,6 @@ main(int argc, char **argv)
|
||||||
if (cls == EFL_NET_SERVER_TCP_CLASS)
|
if (cls == EFL_NET_SERVER_TCP_CLASS)
|
||||||
{
|
{
|
||||||
efl_net_server_tcp_ipv6_only_set(server, ipv6_only);
|
efl_net_server_tcp_ipv6_only_set(server, ipv6_only);
|
||||||
efl_net_server_fd_close_on_exec_set(server, EINA_TRUE); /* recommended */
|
|
||||||
efl_net_server_fd_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
efl_net_server_fd_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
||||||
efl_net_server_fd_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
efl_net_server_fd_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
||||||
|
|
||||||
|
@ -672,7 +671,6 @@ main(int argc, char **argv)
|
||||||
efl_net_server_udp_multicast_join(server, str);
|
efl_net_server_udp_multicast_join(server, str);
|
||||||
|
|
||||||
|
|
||||||
efl_net_server_fd_close_on_exec_set(server, EINA_TRUE); /* recommended */
|
|
||||||
efl_net_server_fd_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
efl_net_server_fd_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
||||||
efl_net_server_fd_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
efl_net_server_fd_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
||||||
if (socket_activated) efl_net_server_fd_socket_activate(server, address);
|
if (socket_activated) efl_net_server_fd_socket_activate(server, address);
|
||||||
|
@ -704,7 +702,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
efl_net_server_ssl_context_set(server, ssl_ctx);
|
efl_net_server_ssl_context_set(server, ssl_ctx);
|
||||||
|
|
||||||
efl_net_server_ssl_close_on_exec_set(server, EINA_TRUE); /* recommended */
|
|
||||||
efl_net_server_ssl_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
efl_net_server_ssl_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
||||||
efl_net_server_ssl_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
efl_net_server_ssl_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
||||||
if (socket_activated) efl_net_server_ssl_socket_activate(server, address);
|
if (socket_activated) efl_net_server_ssl_socket_activate(server, address);
|
||||||
|
|
|
@ -460,7 +460,6 @@ main(int argc, char **argv)
|
||||||
if (cls == EFL_NET_SERVER_TCP_CLASS)
|
if (cls == EFL_NET_SERVER_TCP_CLASS)
|
||||||
{
|
{
|
||||||
efl_net_server_tcp_ipv6_only_set(server, ipv6_only);
|
efl_net_server_tcp_ipv6_only_set(server, ipv6_only);
|
||||||
efl_net_server_fd_close_on_exec_set(server, EINA_TRUE); /* recommended */
|
|
||||||
efl_net_server_fd_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
efl_net_server_fd_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
||||||
efl_net_server_fd_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
efl_net_server_fd_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
||||||
|
|
||||||
|
@ -479,8 +478,6 @@ main(int argc, char **argv)
|
||||||
EINA_LIST_FOREACH(udp_mcast_groups, lst, str)
|
EINA_LIST_FOREACH(udp_mcast_groups, lst, str)
|
||||||
efl_net_server_udp_multicast_join(server, str);
|
efl_net_server_udp_multicast_join(server, str);
|
||||||
|
|
||||||
|
|
||||||
efl_net_server_fd_close_on_exec_set(server, EINA_TRUE); /* recommended */
|
|
||||||
efl_net_server_fd_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
efl_net_server_fd_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
||||||
efl_net_server_fd_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
efl_net_server_fd_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
||||||
if (socket_activated) efl_net_server_fd_socket_activate(server, address);
|
if (socket_activated) efl_net_server_fd_socket_activate(server, address);
|
||||||
|
@ -512,7 +509,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
efl_net_server_ssl_context_set(server, ssl_ctx);
|
efl_net_server_ssl_context_set(server, ssl_ctx);
|
||||||
|
|
||||||
efl_net_server_ssl_close_on_exec_set(server, EINA_TRUE); /* recommended */
|
|
||||||
efl_net_server_ssl_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
efl_net_server_ssl_reuse_address_set(server, EINA_TRUE); /* optional, but nice for testing */
|
||||||
efl_net_server_ssl_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
efl_net_server_ssl_reuse_port_set(server, EINA_TRUE); /* optional, but nice for testing... not secure unless you know what you're doing */
|
||||||
if (socket_activated) efl_net_server_ssl_socket_activate(server, address);
|
if (socket_activated) efl_net_server_ssl_socket_activate(server, address);
|
||||||
|
|
|
@ -312,7 +312,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
server = efl_add(EFL_NET_SERVER_TCP_CLASS, ecore_main_loop_get(), /* it's mandatory to use a main loop provider as the server parent */
|
server = efl_add(EFL_NET_SERVER_TCP_CLASS, ecore_main_loop_get(), /* it's mandatory to use a main loop provider as the server parent */
|
||||||
efl_net_server_tcp_ipv6_only_set(efl_added, EINA_FALSE), /* optional, but helps testing IPv4 on IPv6 servers */
|
efl_net_server_tcp_ipv6_only_set(efl_added, EINA_FALSE), /* optional, but helps testing IPv4 on IPv6 servers */
|
||||||
efl_net_server_fd_close_on_exec_set(efl_added, EINA_TRUE), /* recommended */
|
|
||||||
efl_net_server_fd_reuse_address_set(efl_added, EINA_TRUE), /* optional, but nice for testing */
|
efl_net_server_fd_reuse_address_set(efl_added, EINA_TRUE), /* optional, but nice for testing */
|
||||||
efl_net_server_fd_reuse_port_set(efl_added, EINA_TRUE), /* optional, but nice for testing... not secure unless you know what you're doing */
|
efl_net_server_fd_reuse_port_set(efl_added, EINA_TRUE), /* optional, but nice for testing... not secure unless you know what you're doing */
|
||||||
efl_event_callback_array_add(efl_added, server_cbs(), NULL)); /* mandatory to have "client,add" in order to be useful */
|
efl_event_callback_array_add(efl_added, server_cbs(), NULL)); /* mandatory to have "client,add" in order to be useful */
|
||||||
|
|
|
@ -1496,11 +1496,9 @@ _ecore_con_server_server_set(Ecore_Con_Server *svr, Eo *server)
|
||||||
|
|
||||||
if (efl_isa(inner_server, EFL_NET_SERVER_FD_CLASS))
|
if (efl_isa(inner_server, EFL_NET_SERVER_FD_CLASS))
|
||||||
{
|
{
|
||||||
efl_net_server_fd_close_on_exec_set(inner_server, EINA_TRUE);
|
|
||||||
efl_net_server_fd_reuse_address_set(inner_server, EINA_TRUE);
|
efl_net_server_fd_reuse_address_set(inner_server, EINA_TRUE);
|
||||||
efl_net_server_fd_reuse_port_set(inner_server, EINA_TRUE);
|
efl_net_server_fd_reuse_port_set(inner_server, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (efl_isa(inner_server, EFL_NET_SERVER_TCP_CLASS))
|
if (efl_isa(inner_server, EFL_NET_SERVER_TCP_CLASS))
|
||||||
{
|
{
|
||||||
/* old ecore_con did not map ipv4 to ipv6... */
|
/* old ecore_con did not map ipv4 to ipv6... */
|
||||||
|
@ -1516,7 +1514,6 @@ _ecore_con_server_server_set(Ecore_Con_Server *svr, Eo *server)
|
||||||
{
|
{
|
||||||
/* old ecore_con did not map ipv4 to ipv6... */
|
/* old ecore_con did not map ipv4 to ipv6... */
|
||||||
efl_net_server_ssl_ipv6_only_set(inner_server, EINA_TRUE);
|
efl_net_server_ssl_ipv6_only_set(inner_server, EINA_TRUE);
|
||||||
efl_net_server_ssl_close_on_exec_set(inner_server, EINA_TRUE);
|
|
||||||
efl_net_server_ssl_reuse_address_set(inner_server, EINA_TRUE);
|
efl_net_server_ssl_reuse_address_set(inner_server, EINA_TRUE);
|
||||||
efl_net_server_ssl_reuse_port_set(inner_server, EINA_TRUE);
|
efl_net_server_ssl_reuse_port_set(inner_server, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,7 @@ EOLIAN static Efl_Object *
|
||||||
_efl_net_server_fd_efl_object_constructor(Eo *o, Efl_Net_Server_Fd_Data *pd)
|
_efl_net_server_fd_efl_object_constructor(Eo *o, Efl_Net_Server_Fd_Data *pd)
|
||||||
{
|
{
|
||||||
pd->family = AF_UNSPEC;
|
pd->family = AF_UNSPEC;
|
||||||
|
pd->close_on_exec = EINA_TRUE;
|
||||||
return efl_constructor(efl_super(o, MY_CLASS));
|
return efl_constructor(efl_super(o, MY_CLASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Efl.Net.Server.Fd (Efl.Loop.Fd, Efl.Net.Server) {
|
||||||
@property close_on_exec {
|
@property close_on_exec {
|
||||||
[[Controls Close-on-Exec() using FD_CLOEXEC.
|
[[Controls Close-on-Exec() using FD_CLOEXEC.
|
||||||
|
|
||||||
Children socket will inherit the server's setting by
|
Children socket will not inherit the server's setting by
|
||||||
default. One can change the behavior using each instance
|
default. One can change the behavior using each instance
|
||||||
@Efl.Io.Closer.close_on_exec.set.
|
@Efl.Io.Closer.close_on_exec.set.
|
||||||
]]
|
]]
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Efl.Net.Server.Ssl (Efl.Loop_User, Efl.Net.Server) {
|
||||||
@property close_on_exec {
|
@property close_on_exec {
|
||||||
[[Controls Close-on-Exec() using FD_CLOEXEC.
|
[[Controls Close-on-Exec() using FD_CLOEXEC.
|
||||||
|
|
||||||
Children socket will inherit the server's setting by
|
Children socket will not inherit the server's setting by
|
||||||
default. One can change the behavior using each instance
|
default. One can change the behavior using each instance
|
||||||
@Efl.Io.Closer.close_on_exec.set.
|
@Efl.Io.Closer.close_on_exec.set.
|
||||||
]]
|
]]
|
||||||
|
|
|
@ -481,7 +481,6 @@ ecore_ipc_server_add(Ecore_Ipc_Type type, const char *name, int port, const void
|
||||||
|
|
||||||
if (efl_isa(svr->server, EFL_NET_SERVER_FD_CLASS))
|
if (efl_isa(svr->server, EFL_NET_SERVER_FD_CLASS))
|
||||||
{
|
{
|
||||||
efl_net_server_fd_close_on_exec_set(svr->server, EINA_TRUE);
|
|
||||||
efl_net_server_fd_reuse_address_set(svr->server, EINA_TRUE);
|
efl_net_server_fd_reuse_address_set(svr->server, EINA_TRUE);
|
||||||
efl_net_server_fd_reuse_port_set(svr->server, EINA_TRUE);
|
efl_net_server_fd_reuse_port_set(svr->server, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
@ -495,7 +494,6 @@ ecore_ipc_server_add(Ecore_Ipc_Type type, const char *name, int port, const void
|
||||||
{
|
{
|
||||||
/* old ecore_con did not map ipv4 to ipv6... */
|
/* old ecore_con did not map ipv4 to ipv6... */
|
||||||
efl_net_server_ssl_ipv6_only_set(svr->server, EINA_TRUE);
|
efl_net_server_ssl_ipv6_only_set(svr->server, EINA_TRUE);
|
||||||
efl_net_server_ssl_close_on_exec_set(svr->server, EINA_TRUE);
|
|
||||||
efl_net_server_ssl_reuse_address_set(svr->server, EINA_TRUE);
|
efl_net_server_ssl_reuse_address_set(svr->server, EINA_TRUE);
|
||||||
efl_net_server_ssl_reuse_port_set(svr->server, EINA_TRUE);
|
efl_net_server_ssl_reuse_port_set(svr->server, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue