From: discomfitor Date: Sat, 2 Oct 2010 01:32:54 +0000 (+0000) Subject: some DBG edits, fix case where ssl handshake completes and no more data is sent/received X-Git-Tag: 2.0_alpha~194^2~550 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f8c7b0b8a8d60df6101a5f32e517f5c881df33e6;p=framework%2Fuifw%2Fecore.git some DBG edits, fix case where ssl handshake completes and no more data is sent/received git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@52972 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index f556cab..99d2266 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -1825,41 +1825,45 @@ _ecore_con_cl_handler(void *data, Ecore_Fd_Handler *fd_handler) { DBG("Continuing ssl handshake: preparing to %s...", want_read ? "read" : "write"); #ifdef PRINT_LOTS_OF_DEBUG - char buf[32768]; - ssize_t len; - len = recv(svr->fd, buf, sizeof(buf), MSG_DONTWAIT | MSG_PEEK); - DBG("%zu bytes in buffer", len); + if (want_read) + { + char buf[32768]; + ssize_t len; + len = recv(svr->fd, buf, sizeof(buf), MSG_DONTWAIT | MSG_PEEK); + DBG("%zu bytes in buffer", len); + } #endif - if (!svr->ssl_state) + if (ecore_con_ssl_server_init(svr)) { - /* we got our server! */ - Ecore_Con_Event_Server_Add *e; + ERR("ssl handshaking failed!"); + Ecore_Con_Event_Server_Del *e; - svr->connecting = EINA_FALSE; - e = calloc(1, sizeof(Ecore_Con_Event_Server_Add)); + e = calloc(1, sizeof(Ecore_Con_Event_Server_Del)); if (e) { svr->event_count++; - svr->start_time = ecore_time_get(); e->server = svr; - ecore_event_add(ECORE_CON_EVENT_SERVER_ADD, e, - _ecore_con_event_server_add_free, NULL); + ecore_event_add(ECORE_CON_EVENT_SERVER_DEL, e, + _ecore_con_event_server_del_free, NULL); } } - else if (ecore_con_ssl_server_init(svr)) + else if (!svr->ssl_state) { - ERR("ssl handshaking failed!"); - Ecore_Con_Event_Server_Del *e; + /* we got our server! */ + Ecore_Con_Event_Server_Add *e; - e = calloc(1, sizeof(Ecore_Con_Event_Server_Del)); + svr->connecting = EINA_FALSE; + e = calloc(1, sizeof(Ecore_Con_Event_Server_Add)); if (e) { svr->event_count++; + svr->start_time = ecore_time_get(); e->server = svr; - ecore_event_add(ECORE_CON_EVENT_SERVER_DEL, e, - _ecore_con_event_server_del_free, NULL); + ecore_event_add(ECORE_CON_EVENT_SERVER_ADD, e, + _ecore_con_event_server_add_free, NULL); } } + } else if (want_read) @@ -2174,21 +2178,7 @@ _ecore_con_svr_cl_handler(void *data, Ecore_Fd_Handler *fd_handler) if (cl->handshaking && ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ | ECORE_FD_WRITE)) { - if (!cl->ssl_state) - { - Ecore_Con_Event_Client_Add *add; - - add = calloc(1, sizeof(Ecore_Con_Event_Client_Add)); - if(add) - { -/*cl->event_count++;*/ - add->client = cl; - _ecore_con_cl_timer_update(cl); - ecore_event_add(ECORE_CON_EVENT_CLIENT_ADD, add, - _ecore_con_event_client_add_free, NULL); - } - } - else if (ecore_con_ssl_client_init(cl)) + if (ecore_con_ssl_client_init(cl)) { ERR("ssl handshaking failed!"); /* we lost our client! */ @@ -2206,6 +2196,20 @@ _ecore_con_svr_cl_handler(void *data, Ecore_Fd_Handler *fd_handler) } } + else if (!cl->ssl_state) + { + Ecore_Con_Event_Client_Add *add; + + add = calloc(1, sizeof(Ecore_Con_Event_Client_Add)); + if(add) + { +/*cl->event_count++;*/ + add->client = cl; + _ecore_con_cl_timer_update(cl); + ecore_event_add(ECORE_CON_EVENT_CLIENT_ADD, add, + _ecore_con_event_client_add_free, NULL); + } + } } else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))