Commit Graph

35 Commits

Author SHA1 Message Date
Vincent Torri 092114ecc8 bin/eet and ecore_con: remove Evil.h when not necessary and include evil_private.h when necessary
Test Plan: compilation

Reviewers: raster, zmike, cedric

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8911
2019-05-17 13:51:50 -04:00
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 33c00de365 eo: make efl_future_then have a data pointer in addition of the object pointer.
Summary:
In the case when you have multiple future in flight related to one object, you
couldn't use the previous version of efl_future_then. Now all function calls
take a void* pointer that allow multiple future to have their private data
request data accessible in all the callback.

This should not break released API as Eo.h is not released yet and so
was efl_future_Eina_FutureXXX_then.

Depends on D7332

Reviewers: felipealmeida, segfaultxavi, vitor.sousa, SanghyeonLee, bu5hm4n

Reviewed By: segfaultxavi

Subscribers: #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7472

Differential Revision: https://phab.enlightenment.org/D7379
2018-12-07 12:23:11 +01:00
Cedric BAIL b6346d0bb3 ecore_con: enforce connection state to not let a hanging connection continue.
It is expected that when the connection state is forcefully set, that all
hanging connection should be stopped instead of them continuing and later
resetting the state to having a connection.

Differential Revision: https://phab.enlightenment.org/D7397
2018-12-06 09:29:28 +01:00
Cedric BAIL 4485cf64a0 ecore_con: refactor TCP Dialer to always wait for thread to finish.
This is a better way to avoid race execution by the async end callback
that could happen at some later random point in time. The thread are
cancelled right away, so event if their is a "wait" time set, it should
never actually matter and be always instantaneous.

Differential Revision: https://phab.enlightenment.org/D7396
2018-12-06 09:29:28 +01:00
Cedric BAIL 5de51f84fb eo: rename efl_future_Eina_FutureXXX_then in efl_future_then as this has been available for some time.
Reviewed-by: Vitor Sousa da Silva <vitorsousa@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D7327
2018-11-23 11:39:43 -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
Cedric Bail 25747d0881 ecore: rename efl_loop_Eina_FutureXXX_timeout to efl_loop_timeout. 2017-12-03 16:30:53 -08:00
Vincent Torri 0cdd501246 EFL For WIN32: Replace HAVE_EVIL define with _WIN32 2017-09-22 05:06:10 -05:00
Guilherme Iscaro ec27ceac27 efl_net: Use the new Eina_Future API. 2017-09-04 10:24:00 -03:00
Gustavo Sverzut Barbieri 08c38713ce do not emit events from efl_io_closer_close() on destructor.
On destructor we're not supposed to emit events, I even thought that
would be implicit, but it's not. If we do, for example an event
handler that would 'efl_del()' on "EFL_IO_CLOSER_EVENT_CLOSED" would
trigger too-many unrefs.
2016-12-20 10:18:32 -02:00
Gustavo Sverzut Barbieri 5939f0d9c2 efl_net_dialer: emit 'resolved' even if connection failed.
If we resolved the address but couldn't connect, use
efl_net_socket_address_remote_set() and emit
EFL_NET_DIALER_EVENT_RESOLVED.
2016-12-09 13:47:04 -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 84ee276b12 efl_net_dialer_tcp: remove useless code. 2016-10-26 19:01:03 -02:00
Gustavo Sverzut Barbieri 7a842e0612 efl_net_dialer_tcp: make code bit more robust.
Also avoids the double-set of remote address, since socket.tcp will
alredy do that for us when we efl_loop_fd_set().
2016-10-26 19:01:03 -02:00
Gustavo Sverzut Barbieri cddbce8900 efl_net_*: improve WIN32.
Thanks to vtorri for poiting out about close() is not the correct
socket function, we should use closesocket() instead.

Also defined SOCKET to int on Linux so we can use the same 'type' and
avoid lots of ifdef in our code. On Windows it's unsigned, thus would
cause some warnings about incorrect signed comparison.
2016-10-22 21:49:01 -02:00
Jean-Philippe Andre 7f6f282210 Efl.Loop.User: Use prefix to rename efl_loop_user_loop_get
efl_loop_user_loop_get is idiotic. efl_loop_get should be good enough.
2016-10-06 12:24:59 +09:00
Cedric BAIL 72f0bfa224 ecore,ecore_con: simplify destructor by linking future life cycle with object. 2016-09-21 16:19:53 -07:00
Gustavo Sverzut Barbieri a975bfe1e6 efl_net_dialer_tcp: add SOCKS proxy support.
SOCKS is implemented in its own thread using synchronous/blocking
primitives, which simplifies the code a lot -- as well as simulate the
usage of Ecore_Thread as our users will likely do.

Since SOCKSv4a and SOCKSv5 allow name resolution, the whole
getaddrinfo() is done in the same thread, when needed, instead of a
separate thread to do that, which should also save some resources.

Instead of the legacy ECORE_CON_SOCKS_V4 and ECORE_CON_SOCKS_V5, now
we use socks_proxy, all_proxy and no_proxy. This matches our other
dialers http/websocket (which will use http_proxy, all_proxy and
no_proxy). If desired it's easy to add back support for those
variables, but I think we should just deprecate them. (The legacy code
will keep unchanged, thus direct users of ecore_con_server will still
use those -- just the previous users of ecore_con_server will be
converted to use the new API).
2016-09-19 01:18:14 -03:00
Cedric Bail 03797a33ab ecore,ecore_con: fix migration to efl_future.
Efl_Future actually work with weak reference. So you do not need to
set things to NULL, but you actually need to register the memory location
of the future with efl_future_use.
2016-09-16 19:13:59 -07:00
Cedric Bail 802b146038 ecore_con: forgotten update of Eina_Promise to Efl_Future convertion due to git rebase. 2016-09-15 21:51:15 -07:00
Cedric Bail 95093095f3 ecore_con: migrate use of Eina_Promise to Efl_Future. 2016-09-15 21:49:08 -07:00
Gustavo Sverzut Barbieri f8feeb7d92 efl_net_dialer_* use timeout promise instead of timer object.
i wasn't aware of efl_loop_timeout for one-shot timeout promises, then
use it instead of a full object.
2016-09-13 16:09:29 -03:00
Gustavo Sverzut Barbieri 122b6830b4 efl_net_dialer_tcp: add connect timeout. 2016-09-12 14:48:03 -03:00
Gustavo Sverzut Barbieri bda935c304 efl_net_dialer_tcp: emit EOS on errors.
I/O copier and others may depend on end-of-stream to stop processing,
then emit the EOS on failures.
2016-09-12 13:21:20 -03:00
Gustavo Sverzut Barbieri ea7bc821d5 efl_io_closer: add close_on_exec and close_on_destructor properties.
the purpose of these properties are to make it more uniform the
handling of these auto-close behavior.
2016-09-12 13:18:28 -03:00
Gustavo Sverzut Barbieri cb8695e9d6 efl_net_dialer_tcp: make asynchronous resolve and connect.
both resolve (getaddrinfo()) and connect() are now done in
Ecore_Thread, avoid to block the main loop.

My plan is to always use the threaded connect() using a blocking
socket, only set it to non-blocking after the socket is returned to
the main thread and before it's accessible to the user. It will make
the connect behavior more uniform.

Some errors were moved from HTTP to Dialer as they are more generic.
2016-09-09 20:14:01 -03:00
Vitor Sousa f02ff462e7 efl callbacks: update some events calls to no longer trigger legacy callbacks 2016-08-30 13:59:59 -03:00
Vitor Sousa 8356b16a49 Efl Object: remove legacy callback calls from event_callback_call
Efl.Object.event_callback_call no longer calls legacy smart callbacks;
calling only event callbacks registered with the given event description
pointer.

Create the method Efl.Object.event_callback_legacy_call to inherit the old
behavior from Efl.Object.event_callback_call, calling both Efl.Object events
and legacy smart callbacks.

Update all other files accordingly in order to still supply legacy
callbacks while they are necessary.
2016-08-26 15:45:07 -03:00
Gustavo Sverzut Barbieri e3ee477140 efl_net: better handling for SOCK_CLOEXEC.
On systems where SOCK_CLOEXEC is supported, give it to socket() and if
accept4() is supported, then use it as well.

Otherwise revert to fcntl().
2016-08-24 12:34:59 -03:00
Gustavo Sverzut Barbieri 164d9ddfde Revert "ecore_con: use F_CLOEXEC instead of SOCK_CLOEXEC"
This reverts commit 99d37838f3.

will be fixed in a better way with the following commit.
2016-08-24 12:02:17 -03:00
Jean Guyomarc'h 99d37838f3 ecore_con: use F_CLOEXEC instead of SOCK_CLOEXEC
Mac OS X does not provide SOCK_CLOEXEC. Instead, we can use
fcntl() with F_CLOEXEC.
Fixes Mac OS X build.
2016-08-23 21:15:16 +02:00
Gustavo Sverzut Barbieri 535f111bfa fixup: efl-net 2016-08-22 18:51:19 -03:00
Gustavo Sverzut Barbieri e7df1a7483 efl.net: socket, server and dialer for TCP.
Efl.Net.Server defines how to accept new connections, doing the
bind(), listen() and accept() for protocols such as TCP.

Efl.Net.Dialer defines to to reach a server.

Both are based on Efl.Net.Socket as communication interface that is
based on Efl.Io.Reader, Efl.Io.Writer and Efl.Io.Closer, thus being
usable with code such as Efl.Io.Copier.

The Server will emit an event "client,add" with the established
Socket, which is a child and can be closed by both the server or the
user.

The Dialer extends the Socket and allows for creating one given an
address, that will be resolved and connected.

TCP is the initial implementation so we an validate the
interfaces. UDP, Unix-Local and SSL will come later as derivate
classes.

The examples are documented and should cover the basic principles:

 - efl_io_copier_example can accept "tcp://IP:PORT" and will work as a
   "netcat", can send data from socket, file or stdin to a socket,
   file, stdout or stderr.

 - efl_net_server_example listens for connections and can either reply
   "Hello World!" and take some data or work as an echo-server,
   looping back all received data to the user.

More complex interactions that require a "chat" between client and
server will be covered with new classes later, such as a queue that
empties itself once data is read.
2016-08-22 18:25:14 -03:00