summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con (follow)
AgeCommit message (Collapse)Author
2017-09-22eolian: add mstringDaniel Kolesa
This is a new type representing a mutable string (no const). Regular strings cannot be made mutable with @owned because they might be hidden behind typedefs.
2017-09-22EFL For WIN32: Replace HAVE_EVIL define with _WIN32Vincent 'vtorri' Torri
2017-09-17efl net http - fix protocol error handling to not crash and handle itCarsten Haitzler (Rasterman)
if http server doesnt send even a valid http response and just closes your conenction... dont segv with null pd->cm @fix
2017-09-15ecore: convert existing eo files to new ownershipDaniel Kolesa
2017-09-15efl net - adapt to openssl 1.1.0 changes with tls method supportCarsten Haitzler (Rasterman)
support the tls methods if on openssl 1.1.0 so we don't get "unsupported cipher" as it does support it just with a new api. @fix
2017-09-04efl_net: Use the new Eina_Future API.Guilherme Iscaro
2017-08-10ecore, ecore_con: fix const on Eina.SliceDaniel Kolesa
Fixes TODOs from dd5cdda64b5fd3966718af62d417117942e2f323 after fixing T5024.
2017-07-29efl net - fix ipv6 getsockname to use the proper struct to do itCarsten Haitzler (Rasterman)
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-29efl net ssl constructor - remove double set of same varCarsten Haitzler (Rasterman)
all struct vars are set... one 2x. not a bug but pointless code in the src found by PVS studio
2017-07-28Ecore_Con: Fix wrong comparison.Guilherme Iscaro
Otherwise it will always evaluate to false.
2017-07-28Ecore_Conn: Set EOS only if the connection is not closed.#algo.Guilherme Iscaro
This check prevents that EOS is set on a closed connection. Fixes T5180
2017-07-28Ecore_Con: Fix CLOEXEC documentation.Guilherme Iscaro
The socket attributes are inherited by the child.
2017-07-27Ecore_Conn: Enable CLOEXEC by default.Guilherme Iscaro
This flag should be enabled by default in order to avoid socket leaks.
2017-07-24efl net server udp - report erro on alloc failureCarsten Haitzler (Rasterman)
unwind nicely and complain
2017-07-24ecore con proxy helper - complain when realloc failsCarsten Haitzler (Rasterman)
so you know why things might be failing... complain about out of memory errors.
2017-06-07docs: Fix typos and some wrong expressions in Ecore, Ecore_Audio, ↵Myoungwoon Roy, Kim
Ecore_Cocoa, Ecore_Con, and Ector API reference doxygen. Summary: I had fixed some typos and wrong expressions, such as capital letters, $simbols in .eo and singulars in Ecore, Ecore_Audio, Ecore_Cocoa, Ecore_Con, and Ector API reference doxygen. Test Plan: Doxygen Revision Reviewers: Jaehyun_Cho, stefan, jpeg, cedric, raster Reviewed By: Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D4943
2017-04-25efl.net: rename Ip.Address to Ip_Address.Gustavo Sverzut Barbieri
It's unlikely that we'll have other stuff under Ip namespace, also not that likely to have other than Ip Addresses (to invert it to Address.Ip), thus make a toplevel entry Ip_Address as suggested by DaveMDS.
2017-04-19ecore-con: Remove unused variableChris Michael
Gcc complains that 'flags' here may be used uninitialized. In looking at the code, 'flags' does not seem to be needed in the debug prints here. If we keep and initialize the variable to 0 during declaration, it would only ever print out 0 anyway as 'flags' is never changed in the code. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18ecore_con: use new API eina_file_close_on_exec.Cedric BAIL
2017-04-12ecore_con: send server_upgrade event *after* clearing pending savesBryce Harrington
Summary: The _ecore_con_post_event_server_upgrade() call adds an event to free the server_upgrade object, svr, via _ecore_con_server_free(svr) so we should assume srv is freed after it returns. Thus, perform the pending_slice processing prior to calling it. Otherwise it triggers an illegal access (USE_AFTER_FREE) error in Coverity. @fix CID1373485 Reviewers: barbieri Reviewed By: barbieri Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4785 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-04-08efl_net_socket_ssl (dialer): emit "resolved"Gustavo Sverzut Barbieri
for dialers we should also monitor "resolved" from inner TCP socket and emit that ourselves, letting people know that we have an IP address. this is important for ecore_con_legacy.c, since the svr->ip is only decoded and stored once when this signal is emitted.
2017-04-08ecore_con_legacy: fix legacy compatibility for ecore_con_server_send()Gustavo Sverzut Barbieri
Since efl_net_ssl_context is immutable for a dialer and we create the dialer with the context, the SSL cases uses a trick to postpone dialer creation using a job, then it allows one main loop iteration for the user to call various ecore_con_server_ssl_*() methods. However this breaks immediate ecore_con_server_send() after ecore_con_server_connect() as used to be allowed and used by azy/erssd. Most people wouldn't notice that, since the most common case is to either use ecore_con_url (which uses cURL and a complete different code path) OR they would wait for ECORE_CON_EVENT_SERVER_ADD prior to sending data. Nonetheless it was a compatibility issue and must be fixed. Fixes T5339
2017-03-29ecore_con: remove warnings if FD_CLOEXEC is undefined.Gustavo Sverzut Barbieri
currently it's being defined in evil_fcntl.h, but the actual implementation of fcntl() in evil_fcntl.c is causing problems with sockets. So one possibility is to remove the ifdef, another is to change the implementation.
2017-03-29ecore_con_local_path_new(): implemented for WindowsGustavo Sverzut Barbieri
2017-03-29implement efl_net_{socket,dialer,server}_windowsGustavo Sverzut Barbieri
This is the local socket for windows, analogous to AF_UNIX. `Efl_Net_Socket_Windows` is the base class doing `ReadFile()` and `WriteFile()` using overlapped I/O, as well as the close procedure (`FlushFileBuffers()`, `DisconnectNamedPipe()` and `CloseHandle()`). These are done on top of an existing HANDLE that is set by `Efl_Net_Dialer_Windows` (from `CreateFile()`) or `Efl_Net_Server_Windows` (from `CreateNamedPipe()`). The overlapped I/O will return immediately, either with operation completed or `ERROR_IO_PENDING`, which means the kernel will execute that asynchronously and will later `SetEvent(overlapped.hEvent)` which is an event we wait on our main loop. That `overlapped` handle must exist during the call lifetime, thus cannot be bound to `pd`, as we may call `CancelIo()` but there is no guarantee the memory won't be touched, in that case we keep the overlapped around, but without an associated object. Windows provides no notification "can read without blocking" or non-blocking calls that returns partial data. The way to go is to use these overlapped I/O, with an initial `ReadFile()` to an internal buffer, once that operation finishes, we callback the user to says there is something to read (`efl_io_reader_can_read_set()`) and wait until `efl_io_reader_read()` is called to consume the available data, then `ReadFile()` is called again to read more data to the same internal buffer. Likewise, there is no "can write without blocking" or non-blocking calls that sends only partial data. The way to go is to get user bytes in `efl_io_writer_write()` and copy them in an internal buffer, then call `WriteFile()` on that and inform the user nothing else can be written until that operation completes (`efl_io_writer_can_write_set()`). This is cumbersome since we say we "sent" stuff when we actually didn't, it's still in our internal buffer (`pd->send.bytes`), but nonetheless the kernel and the other peer may be adding even more buffers, in this case we need to do a best effort to get it delivery. A particular case is troublesome: `write() -> close()`, this may result in `WriteFile()` pending, in this case we wait using `GetOverlappedResult()`, *this is nasty and may block*, but it's the only way I see to cope with such common use case. Other operations, like ongoing `ReadFile()` or `ConnectNamedPipe()` will be canceled using `CancelIo()`. Q: Why no I/O Completion Port (IOCP) was used? Why no CreateThreadpoolIo()? These perform much better! A: These will call back from secondary threads, but in EFL we must report back to the user in order to process incoming data or get more data to send. That is, we serialize everything to the main thread, making it impossible to use the benefits of IOCP and similar such as CreateThreadpoolIo(). Since we'd need to wakeup the main thread anyways, using `OVERLAPPED.hEvent` with `ecore_main_win32_handler_add()` does the job as we expect. Thanks to Vincent Torri (vtorri) for his help getting this code done with an example on how to do the NamedPipe handling on Windows.
2017-03-26Ecore_Con: Fix compilation on SolarisVincent Torri
FIONREAD is defined in sys/filio.h
2017-03-09ecore_con: avoid potential crash during shutdown due to Ecore_Event queue.Cedric BAIL
2017-02-27docs: Fix typos and some wrong expressions in Ecore and Edje API reference ↵Myoungwoon Roy, Kim
doxygen. Summary: I had fixed some typos and wrong expressions, euch as capital letters, singular Etc. in Ecore and Edje API reference doxygen. Test Plan: Doxygen Revision Reviewers: stefan, cedric, raster, Jaehyun_Cho, jpeg Subscribers: conr2d Differential Revision: https://phab.enlightenment.org/D4677
2017-02-13doxygen: Fix typos & invalid statements in ecoreMyoungwoon Roy, Kim
This covers ecore audio, avahi, buffer and con. Summary: There are some typos and cacologigue statements in doxygen of ecore_audio, ecore_avahi, ecore_buffer, and ecore_con. Test Plan: API Doxygen Revision Reviewers: stefan, cedric, raster, Jaehyun_Cho Subscribers: jpeg, conr2d Differential Revision: https://phab.enlightenment.org/D4652
2017-02-08ecore_con - only use XDG_RUNTIME_DIR if not setuidCarsten Haitzler (Rasterman)
this should address possible misuse of this env var in setuid apps. keep using home and tmp to maintain socket "abi" (the filenames that are used).
2017-02-08ecore_con proxy helper - fix null return handling for thread q waitCarsten Haitzler (Rasterman)
this fixes CID 1368376
2017-02-03ifdef RUN_IN_TREE logic.Gustavo Sverzut Barbieri
This logic is only needed for autotools, cmake will replicate the installation file structure and thus eina_prefix works out of box.
2017-02-03ecore_con/efl_net - dedicated threads for network i/o not from the poolCarsten Haitzler (Rasterman)
so ecore_con/efl_net were using the standard ecore_thread thread pool for doing things like dns lookups (that can take multiple minutes until timeouts) and actual http transactions. similarly they can block thread workers for long periods or indefinitely thus basically blocking the whole eocre_thread pool and stopping others from sharing it. the best solution we have right now is to bypass the thread pool queue and have dedicated threads for these actions. what we should have is a dedicated thread pool with each thread taking on N connections (via select etc.) and the ability to create and destroy thread pools for specific tasks so you can separate the work out from other work. but that is basically a redesign of our thread pool infra so let's do the quick solution here until that day comes. this partially addresses D4640 a dedicated thread per image load though is going to be a lot nastier...
2017-02-01efl_net_dialer_http: check for finished handles after unpause.Gustavo Sverzut Barbieri
After we call curl_multi_socket_action() we must call _efl_net_dialer_http_curlm_check() in order to call curl_multi_info_read() and be notified of handles that were finished. Otherwise the handle is gone and we'll be waiting for an action that will never happen. Fixes T5079
2017-01-27cmake: add ecore_con.Gustavo Sverzut Barbieri
2017-01-27ecore_con: add missing string nul byte terminator to efl_net_ip_address.Gustavo Sverzut Barbieri
2017-01-13eolian: change eo file syntax @virtual_pure -> @pure_virtualDaniel Kolesa
2017-01-11eolian: enforce specification of both get and set in prop implsDaniel Kolesa
Now you can't use the same syntax as you would for a method to implement a property as whole, instead you need to specify the getter and/or setter explicitly. This is to allow parent classes to expand their properties without altering behavior of the child classes.
2017-01-09ecore_con - move libproxy to a slave binary with stdin/out msgingCarsten Haitzler (Rasterman)
so here's the ugly problem. libproxy. yes. we've discussed memory usage (e.g. it may have to execute javascript and pull in lots of deps etc.) but we dlopene'd on the fly. ok... but this didn't solve another issue i hit: libproxy was causing enlightenment to abort(). some internal bit of libproxy was raising a c++ exception. this wasn't caught. this causes an abort(). takes down your entire desktop. FANTASTIC. this is bad. i wouldnt' expect a library we depend on to be THIS anti-social but libproxy seemingly is. it SHOULd catch its error sand just propagate back to us so we can handle gracefully. there reall is no way around this - isolate libproxy. it's even worse that libproxy can load arbitrary modules that come from anywhere sho who knows what issues this can cause. isolation is the best solution i can think of. so this makes an elf+net_proxy_helper we spawn the first time we need a proxy lookup. we re-use that binary again and again until it exits (it should exit after 10 seconds of being idle with no requests coming in/pending). it'll respawn again later if needed. this involves now the efl net threads having to marshall back to mainloop to do the spawn and to write to the proxy process (reading is done by async exe data events and the data is passed down a thread queue to the waitng efl net thread). if the exe dies with pending requests unanswered then it's respawned again and the req's are re-sent to it... just in case. it has a limit on how often it'll respawn quickly. this seems to work in my limited testing. this ALSO now isolates memory usage of libproxy to another slave process AND this process will die taking its memory with it once it's been idle for long enough. that;s also another good solution to keeping libproxy impact at bay.
2017-01-04openssl 1.1 build break fixesCarsten Haitzler (Rasterman)
this fixes building against openssl 1.1 since it broke api in various ways by hiding structs and deprecating api's (this causes warnings not breaks unlike the struct hiding). this adapts to these changes and makes efl build again. @fix
2016-12-27ecore con: use new property impl syntaxDaniel Kolesa
2016-12-23Ecore_Con_Url/Curl: add consistency for _c init/shutdownDaniel Zaoui
_c_init was not called from Ecore_Con_Url although _c_shutdown was.
2016-12-23Ecore_Con_Url/Curl: add referencing on _c structureDaniel Zaoui
The _c structure used to store the Curl function pointers needs referencing to be sure it is not freed although still needed. The non-referencing was leading to a crash during the destruction of the dialers. The _c was still used although it has been freed by ecore_con_url_shutdown.
2016-12-20ecore_con_legacy: fix compatibility behavior (eos-mark on receiver done).Gustavo Sverzut Barbieri
While a socket can be closed to receive data resulting in EOS, it could still be used to send stuff. Then it won't result in "finished", just "read,finished" event. However, previously this was considered a disconnect and we must respect this otherwise tests (Ecore_Con_Eet suite) will hang waiting for a disconnect.
2016-12-20do not emit events from efl_io_closer_close() on destructor.Gustavo Sverzut Barbieri
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-20efl_io_reader/writer: always set 'can_*' to FALSE on errors.Gustavo Sverzut Barbieri
If user tries to read or write and that fails then set 'can_read' or 'can_write' to false, regardless of the error code.
2016-12-19efl_net_server_udp_client: make error easier to understand.Gustavo Sverzut Barbieri
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.
2016-12-19efl_net_socket_udp: expose init() as protected method.Gustavo Sverzut Barbieri
remove one more TODO: since Efl.Net.Ip.Address was introduced we can now expose Efl.Net.Socket.Udp.init as a protected method that will configure the internal address we use for the remote peer. This allow subclasses to override or call such methods.
2016-12-19efl_net_socket_ssl: remove TODO leftover.Gustavo Sverzut Barbieri
There are no jobs to stop there, it was a left over since this code was somehow derived from Efl.Loop_Fd where "read" and "write" would constantly be called until the kernel flag was cleared, there the callback must be removed to stop jobs, not here.
2016-12-19more eo simplified to use Eina_Slice instead of pointer to.Gustavo Sverzut Barbieri
Working directly with Eina_Slice is easier than a pointer to it, requires no validation of the pointers and is cheap since it's just putting together size_t + void*. However we can't hint the user of 'const(Eina.Slice)' properties as Eolian is incorrectly generating getters as: const Eina_Slice class_property_get(...) which is makes compilers complain about ignored qualifiers: ../src/lib/ecore/efl_io_copier.eo.h:329:7: warning: 'const' type qualifier on return type has no effect [-Wignored-qualifiers] Leave some TODO so @q66 can fix those.