Commit Graph

14 Commits

Author SHA1 Message Date
Mike Blumenkrantz 36661a436e efl-net: namespace events to avoid naming conflicts
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8260
2019-03-08 12:17:51 -08:00
Cedric BAIL 33fd77e9e4 ecore: move close_on_destructor to close_on_invalidate as that describe the behavior best.
Fix all use to correctly behave on invalidate.
2018-05-01 10:39:01 -07:00
Daniel Kolesa fcae7cab27 eolian gen: enable constness generation on property getter impls
This changes a lot of things all across the EFL. Previously,
methods tagged @const had both their external prototype and
internal impl generated with const on object, while property
getters only had const on the external API. This is now changed
and it all has const everywhere.

Ref T6859.
2018-04-17 20:31:55 +02:00
Carsten Haitzler b22b2ded1d ecore_con: bug workaround SO_REUSEADDR and EADDRINUSE from bind (fix)
what i'm seeing is this with local unix sockets:

1. server process not cleanly shut down (kill -9 for example).
2. run server process again and bind fails due to EADDRINUSE
3. we ARE doing setsockopt() with SO_REUSEADDR set to 1 ...

this just makes no sense because setsockopt() SHOULD allow use to
re-use... the previous efreetd process for example is gone. no such
process, yet socket is not re-usable. this should just not happen due
to SO_REUSEADDR, but it does. this has nasty consequences like efreetd
maybe never running because of stale sockets. this should never have
happened, but it does. odd. so a hacky workaround:

1. try bind.
2. if bind fails with EADDRINUSE and its a socket path AND
pd->unlink_before_bind is NOT set... then try a connect to the socket.
3. if connect succeeds then fail as normal (close socket and error on
bind'ing)
   if connect fails then we have a stale socket, so unlink it
forcibly. create the socket again and try bind again.

hacky but... fixes the core issue.

@fix
2017-12-20 21:10:53 +09:00
Carsten Haitzler ff26991220 efl net - fix ipv6 getsockname to use the proper struct to do it
struct sockaddr_storage *addr;

AS the actual storage ( a ptr to store the whole data). kind of...
wrong. it should be:

      struct sockaddr_storage addr;

see examples of this kind of usage of getsockname:

http://www.masterraghu.com/subjects/np/introduction/unix_network_programming_v1.3/ch04lev1sec10.html

found by PVS studio

@fix
2017-07-29 10:56:47 +09:00
Gustavo Sverzut Barbieri 96eccc2753 efl_net: move error COULDNT_RESOLVE_HOST to broader scope.
This error is shared by Dialer and Server, will also be used by IP
resolution.
2016-12-12 02:30:33 -02:00
Gustavo Sverzut Barbieri 324b4e93f5 efl_net_server_unix: do not mkpath for abstract sockets. 2016-12-09 13:47:04 -02:00
Gustavo Sverzut Barbieri 48049a4ce2 efl_net_server_unix: add leading_directories_create property.
This allows us to crete any parent directories that are missing.
2016-11-25 18:01:29 -02:00
Gustavo Sverzut Barbieri 410d65900c efl_net_server: add 'client_announce', share logic and fix a bug.
I just realized that if a client is not referenced it would leak in
the 'ssl' server as we must del it.

However, if we del the SSL socket, we're going to close the underlying
TCP. But we're from the TCP "client,add" callback and this causes
issues since "closed" will be emitted, our close callback will
unparent the client, which lead to it being deleted.

The proper solution is to only monitor "closed" if the client is
accepted. Otherwise we just check if it was closed, if we're the
parent, etc...

Fixing this in all servers were painful, we could share since most
inherit from Efl.Net.Server.Fd. Then add the "client_announce"
protected method to do it, and document how it should work.
2016-11-25 17:25:18 -02:00
Gustavo Sverzut Barbieri d0b6aa6596 efl_net_server_unix: do bind() from serve() method.
Instead of adding a job to create the socket and call bind(), do it
straight from the serve() method, this allows the caller to set
umask(), permissions and so on.

Document this behavior in the class, since we can't extend the
method's documentation.
2016-11-23 18:38:24 -02:00
Gustavo Sverzut Barbieri 5818dc71da efl_net: use SOCKET_FMT to format SOCKET so it works on UNIX and Windows.
On Windows SOCKET is unsigned, thus will cause sign errors when
formatting with "%d" or comparing with signed values.

On UNIX it was quiet and easy to miss, thus a new #define can be used
to check for those. It will use 'unsigned long' as SOCKET, thus will
complain out loud and not even work correctly when using pointers on
64bits UNIX on mistakes -- which should improve the situation.

This helped to fix lots of missing conversions, all fixed.

This partially addresses D4357.
2016-11-18 12:53:32 -02:00
Gustavo Sverzut Barbieri 21617f83c2 efl_net_server_unix: fix invalid socket comparison.
Fixes CID 1365321.
2016-11-09 17:25:27 -02:00
Gustavo Sverzut Barbieri c2630c829f efl_net_server support systemd socket activation.
It includes extensive verifications to avoid mistakes and usage of
incorrect sockets.
2016-11-01 16:37:04 -02:00
Gustavo Sverzut Barbieri 651ff13616 addded efl_net_{socket,dialer,server}_unix
This introduces AF_UNIX server and dialer, these are not available on
Windows as in that platform we'll create a custom class for native
'local' communication.

In the future we can add a wrapper class Efl.Net.Local that will use
the class for each platform, but won't expose its details.

For instance, if we ever expose 'credentials' (which I didn't because
they are not portable), then it doesn't make sense to try to match
that on Windows. The 'Efl.Net.Local' would just stick to the basics:
Reader, Writer and Closer APIs.
2016-10-26 19:01:03 -02:00