efl_net_server_udp_client: make error easier to understand.

UDP client has no socket on its own, so it can't be marked as
close-on-exec, however failing to resolve the method is bad as
confuses the user.

Instead provide a method that checks if the setting is different from
parent, in such case provide a meaningful message. Otherwise just be
quiet.
This commit is contained in:
Gustavo Sverzut Barbieri 2016-12-19 17:19:45 -02:00
parent a995529a46
commit 42923bc29e
2 changed files with 19 additions and 0 deletions

View File

@ -274,6 +274,24 @@ _efl_net_server_udp_client_efl_io_closer_close_on_destructor_get(Eo *o EINA_UNUS
return pd->close_on_destructor;
}
EOLIAN static Eina_Bool
_efl_net_server_udp_client_efl_io_closer_close_on_exec_set(Eo *o, Efl_Net_Server_Udp_Client_Data *pd EINA_UNUSED, Eina_Bool close_on_exec)
{
if (efl_net_server_fd_close_on_exec_get(efl_parent_get(o)) != close_on_exec)
{
ERR("Efl.Net.Server.Udp.Client close-on-exec must be the same as the server setting, no file descriptor is created for each client!");
return EINA_FALSE;
}
return EINA_TRUE;
}
EOLIAN static Eina_Bool
_efl_net_server_udp_client_efl_io_closer_close_on_exec_get(Eo *o, Efl_Net_Server_Udp_Client_Data *pd EINA_UNUSED)
{
return efl_net_server_fd_close_on_exec_get(efl_parent_get(o));
}
EOLIAN static void
_efl_net_server_udp_client_efl_net_socket_address_local_set(Eo *o EINA_UNUSED, Efl_Net_Server_Udp_Client_Data *pd, const char *address)
{

View File

@ -30,6 +30,7 @@ class Efl.Net.Server.Udp.Client (Efl.Object, Efl.Net.Socket) {
Efl.Io.Closer.close;
Efl.Io.Closer.closed.get;
Efl.Io.Closer.close_on_destructor;
Efl.Io.Closer.close_on_exec;
Efl.Io.Reader.can_read;
Efl.Io.Reader.eos;
Efl.Io.Reader.read;