Commit Graph

91 Commits

Author SHA1 Message Date
Tom Hacohen c662934be8 Change the EFL to follow the new Eo rename. 2016-08-11 17:04:43 +01:00
Carsten Haitzler 865b10d739 ecore-con - dont complain about socket setup issues when api handles it
ecore-con api returns failure cases and ecore-con shouldt go spamming
stderr with this as it's inteded to be handled at the api level, so
slience!
2016-06-13 18:12:33 +09:00
Tom Hacohen a6a2338962 Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba.

It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.

We would have an issue with references and objects being freed too soon
and in general, issue with the references.

Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.

eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 13:33:21 +01:00
Tom Hacohen 546ff7bbba Eo: Remove eo_del() and make eo_unref() the replacement.
We used to have eo_del() as the mirrored action to eo_add(). No longer,
now you just always eo_unref() to delete an object. This change makes it
so the reference of the parent is shared with the reference the
programmer has. So eo_parent_set(obj, NULL) can free an object, and so
does eo_unref() (even if there is a parent).

This means Eo no longer complains if you have a parent during deletion.
2016-05-17 16:23:23 +01:00
Tom Hacohen 70b5f3875e Efl network: Remove the no longer needed .Base hack. 2016-05-11 13:00:57 +01:00
Daniel Zaoui 49f0f09661 Ecore_Con: protect access to internal data 2016-04-10 15:15:08 +03:00
Tom Hacohen 8706d03b43 Change the EFL according to the renaming of the eo_add() current object. 2016-03-15 15:25:54 +00:00
Tom Hacohen f24210caac Revert "Automatic migration to the new eo_add syntax."
This reverts commit 4f949a2757.
2016-03-11 12:29:03 +00:00
Tom Hacohen 4f949a2757 Automatic migration to the new eo_add syntax. 2016-03-09 16:09:14 +00:00
Tom Hacohen 23a6b12183 Fix migration script mistakes and compilation warnings.
Mostly unused vars following the removal of eo_do_ret().
However, there are some cases where the migration script got some things
wrong, and I had to manually fix them.
2016-03-03 09:58:08 +00:00
Tom Hacohen f21ade6123 Automatic migration to Eo4.
I just ran my script (email to follow) to migrate all of the EFL
automatically. This commit is *only* the automatic conversion, so it can
be easily reverted and re-run.
2016-03-03 09:58:08 +00:00
Srivardhan Hebbar 865624dab0 ecore_con: changing from Ecore.Con.Base to Efl.Network.Base.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D3696

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-02-18 11:25:21 -08:00
Srivardhan Hebbar b1e1186b8e ecore_con: change Ecore.Con.Client to Efl.Network.Client.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D3663

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-02-12 21:25:55 +01:00
Srivardhan Hebbar fca9ff1322 ecore_con: changing Ecore.Con.Server to Efl.Network.Server.
Summary: Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Subscribers: jpeg

Differential Revision: https://phab.enlightenment.org/D3549

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-02-05 08:10:52 +01:00
Jean-Philippe Andre 22324f21b3 EFL: Mark EOLIAN functions as static when possible
This affects mostly evas filters.
2016-01-13 15:34:20 +09:00
Jean Guyomarc'h 2ecd11e221 ecore_con: fix compiling on OS X
IPV6_ADD_MEMBERSHIP does not exist on OS X, and seems to be obsolete,
according to my glibc's bits/in.h.
IPV6_JOIN_GROUP, however, exists on both.

@fix
2016-01-07 12:03:04 +01:00
Srivardhan Hebbar dc56052150 ecore_con: from ecore_con_connector to efl_network_connector.
Summary:
Changed ecore_con_connector.eo to efl_network_connector.eo as part of
migrating to efl_network.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3427

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-01-04 12:35:41 -08:00
Cedric BAIL 1a9e42d124 ecore_con: fix typo preventing IPv6 multicast to work.
Thanks Vincent Torri for spotting it.
2015-12-28 14:01:15 -08:00
Chidambar Zinnoury 4983ac6d36 ecore con: Fix UDP sockets.
The client structure holds a file descriptor, which is not initialized (which means 0) in case of UDP as there is no client-specific socket.

 However, we check for the file descriptor being positive before closing it in the client destructor, which means that we actually end up closing the 0 file descriptor.

 That means that things were going crazy with real strange things happening afterwards…
2015-11-20 17:46:38 +01:00
Carsten Haitzler 6483dc3ce9 ecore con - fix object data referencing for deleted objects
if the object has been deleted already, scope data is null. handle it
correctly. this fixes a segv in the new efreetd when it starts and
there is an existing efreet running thus owning the socket fails.

@fix
2015-06-25 13:18:22 +09:00
Cedric BAIL 69e44c24e3 ecore_con: fix error handling case.
Since the move to Eo, in case of error we do not need to cleanup anything when
finalize finish. The kill function was arranged to do so, but it was still emiting
an event exposing the invalid Eo object. Looking closely at the code, that should
have not happened, as there was no symetrical ADD event and the function would do
nothing else. So removing it. This prevent any potential SEGV from a function that
would catch the DEL event.

@fix
2015-06-03 17:14:12 +02:00
Tom Hacohen 6efbfe227a Eo: Add a return value to eo_constructor().
From now on, constructors should return a value, usually the object
being worked on, or NULL (if the constructor failed). This can also
be used for implementing singletons, by just always returning the same
object from the constructor.

This is one of the final steps towards stabilizing Eo.

@feature
2015-05-20 13:03:24 +01:00
Cedric BAIL 9c571f01f7 ecore_con: it doesn't make sense to get port on local protocol. 2015-05-14 18:41:48 +02:00
Srivardhan Hebbar 05881ea61a ecore_con: fix dns lookup crash issue.
Summary:
When executed ecore_con_lookup_example function, we were getting a crash. This is the fix for the crash. I analysed it in the valgrind and found the error. Valgrind reported invalid free at this place.
svr->name is getting freed in _ecore_con_server_eo_base_destructor function and svr is getting freed in ecore_con_shutdown function.
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2398

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-04-22 15:10:19 +02:00
Jean-Philippe Andre a812df7311 Ecore_Con: Fix clang warnings 2015-04-21 20:11:02 +09:00
Cedric BAIL 54fa8c7e42 ecore_con: fix rebase issue.
Catched by Coverity CID 1287124.
2015-03-07 15:53:40 +01:00
Srivardhan Hebbar 9b1cdff941 ecore_con: Not returning error if port is less than zero for local sockets.
Summary:
If the socket is local, then there is no need to through error if the port is less than 0 (i.e., negetive). The behavior is same in _ecore_con_connector_eo_base_finalize funtion. So applied the same here. There is code in ecore_con_local.c to handle if port is less than zero for local sockets.
In _ecore_con_connector_eo_base_finalize function, I've added a space just so that it shows difference in phabricator and  would be easy for you to review.

Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2089
2015-03-06 20:19:21 +01:00
Srivardhan Hebbar 6721800e7b ecore_con: calling ecore_con_local_init/shutdown from ecore_con_init/shutdown.
Summary:
ecore_con_local doesn't currently require any initialization, but it might need
that on some platform and not having the init make the source code non obvious.
This is just a patch to improve future maintenability.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2098

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-03-06 20:19:21 +01:00
Tom Hacohen 648ad2591c Fix code to conform to recent Eo changes. 2015-02-23 17:16:02 +00:00
Guillaume Friloux 797c921f10 ecore_con: EAGAIN is replaced by WSAEWOULDBLOCK on Windows. 2015-02-11 17:03:39 +01:00
Guillaume Friloux d0dabf8613 ecore: improve network events handling on Windows. 2015-02-11 17:03:39 +01:00
Guillaume Friloux 211d54dc8e ecore_con: make disconnects work on Windows. 2015-02-11 17:03:38 +01:00
Guillaume Friloux 388f8fbcaa ecore_con: fix use of FormatMessage for error reporting on windows.
@fix
2015-02-11 17:03:38 +01:00
Guillaume Friloux d6f08ba032 ecore_con: silent warning with send() usage. 2015-02-11 17:03:38 +01:00
Guillaume Friloux c77c0107a2 ecore_con: use send() instead of write() for portability. 2015-02-11 17:03:37 +01:00
Guillaume Friloux 8873bfeb2b ecore_con: use recv() instead of read for better portability. 2015-02-11 17:03:37 +01:00
Guillaume Friloux e57c1d396e ecore_con: fix _ecore_con_server_flush on Windows.
@fix
2015-02-11 17:03:37 +01:00
Nicolas Aguirre 7d4f95171c ecore_con: Fix checks from socket() and accept() under windows.
import from Guillaume Friloux ecore's fork : ab2d406a37
2015-02-11 17:03:37 +01:00
Guillaume Friloux 0e8e4b2728 ecore_con: use ioctlsocket() when building for windows.
fcntl() doesnt work under windows.

References :
- http://msdn.microsoft.com/en-us/library/windows/desktop/ms738573%28v=vs.85%29.aspx
- http://msdn.microsoft.com/en-us/library/windows/desktop/ms740096%28v=vs.85%29.aspx

imported from Guillaume Friloux ecore fork : 66da77d491
2015-02-11 17:03:37 +01:00
Srivardhan Hebbar a2d40968df Ecore_con: fix initialisation clean up and avoid memory leak.
Summary: When ecore_init failed or when failed to initialize ecore_con_log_domain, then evil_shutdown was not called. So cleaned up code and added the fix.

@fix

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1921

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-05 11:27:00 +01:00
Cedric BAIL aa69cd89a6 ecore_con: the timer callback is waiting for the Eo object not its private data.
This @fix T1962 .
2014-12-30 11:19:38 +01:00
Srivardhan Hebbar be5b00cfd1 ecore_con: Added test case to check if _ecore_con_init_count goes below zero.
Summary:
_ecore_con_init_count should not go below zero. I've added a test case to test this and also the code to fix this.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1603
2014-10-29 08:24:53 -04:00
Guillaume Friloux 101c13d582 ecore_con: Fix connect() handling
If connect() returns 0, we must send the ECORE_CON_EVENT_SERVER_ADD event
because it wont be given by select(). select() will ONLY notice it if connect
returns -1 with errno set to EINPROGRESS.

This bug is reproductible with 100% chance using ecore_con_telnet_client example
from https://github.com/gfriloux/examples if you connect to 127.0.0.1 instead of
of an external network ip, under FreeBSD (and likely any BSD).

Seems very rare to trigger it under GNU/Linux as it seems that connect()
doesnt want to return 0 when having non blocking sockets (or is too slow),
but it seems i was having this bug too on production servers, without being
ever able to reproduce it.
2014-10-08 15:34:48 -04:00
Cedric BAIL 93b865767f ecore_con: check that we have an actual server data before using it. 2014-10-07 16:28:52 +02:00
Marcel Hollerbach f5e24c3bcf ecore_con: Fix error goto, scope data should not be freed
Summary:
If the function jumpes to the error, the scope data is freed, this is
wrong, just the object should be destroyed, so not free, just eo_unref
the object. Cause the object is just added above the object ref count
should get 0 and obj will get removed

Test Plan: Use the ecore_con_server_client_limit_set function and set the max count to 1, at the connect of a second client the server will fail at this free.

Reviewers: tasn

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1459
2014-09-19 02:16:37 +01:00
Stefan Schmidt fdc8e455e4 ecore_con: Make sure host_server is not NUL before dereferencing
This was intended to get fixed in f53683f76a

CID 1232731
2014-09-04 10:57:19 +02:00
Tom Hacohen 0c9a1d8a99 Ecore con: Add Connector class (the connecting variant of server).
This change also consists of cleaning up the server class and adding a
constructor and a finalizer to it.
2014-09-01 12:35:22 +01:00
Tom Hacohen 056c54ebc9 Ecore con server: Fix destructor to call super correctly. 2014-09-01 11:12:17 +01:00
Mike Blumenkrantz 7b0db79c2d revert all recent ecore-con related eo changes. completely broken.
please test things before committing.

reverts all changes since and including f6156c9a62
2014-08-30 08:12:54 -04:00
Tom Hacohen 607901fb0e Ecore con server: Fix destructor to call super correctly. 2014-08-29 10:26:23 +01:00