discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=101c13d582a38a8e3886c14032b2ae3fa92e8351

commit 101c13d582a38a8e3886c14032b2ae3fa92e8351
Author: Guillaume Friloux <[email protected]>
Date:   Wed Oct 8 11:53:15 2014 +0200

    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.
---
 src/lib/ecore_con/ecore_con.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index b42e24e..5c2b8a3 100644
--- a/src/lib/ecore_con/ecore_con.c
+++ b/src/lib/ecore_con/ecore_con.c
@@ -1772,8 +1772,11 @@ _ecore_con_cb_tcp_connect(void *data,
                                     _ecore_con_cl_handler, obj, NULL, NULL);
      }
    else
-     svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
-                                                 _ecore_con_cl_handler, obj, 
NULL, NULL);
+     {
+        ecore_con_event_server_add(obj);
+        svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ,
+                                                    _ecore_con_cl_handler, 
obj, NULL, NULL);
+     }
 
    if (svr->type & ECORE_CON_SSL)
      {

-- 


Reply via email to