summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2010-12-11 16:51:29 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2010-12-11 16:51:29 +0000
commitee1d0dbc23ca8e408400969cf3e85a51f81c9bdf (patch)
tree2dee59c383703d7604badda2c3c2bb293434b631 /legacy
parent2e0a136385bd3c794e845c58192142d008af3928 (diff)
use more explicit error checks
SVN revision: 55498
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ecore/src/lib/ecore_con/ecore_con.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/legacy/ecore/src/lib/ecore_con/ecore_con.c b/legacy/ecore/src/lib/ecore_con/ecore_con.c
index 411759883e..9e8b50cb0f 100644
--- a/legacy/ecore/src/lib/ecore_con/ecore_con.c
+++ b/legacy/ecore/src/lib/ecore_con/ecore_con.c
@@ -1937,8 +1937,7 @@ _ecore_con_cl_udp_handler(void *data,
1937 errno = 0; 1937 errno = 0;
1938 num = read(svr->fd, buf, READBUFSIZ); 1938 num = read(svr->fd, buf, READBUFSIZ);
1939 1939
1940 if ((errno == EIO) || (errno == EBADF) || (errno == EPIPE) || (errno == EINVAL) || 1940 if ((errno != EAGAIN) && (errno != EINTR))
1941 (errno == ENOSPC) || (errno == ECONNREFUSED))
1942 _ecore_con_server_kill(svr); 1941 _ecore_con_server_kill(svr);
1943 1942
1944 if ((num < 1) || (svr->delete_me)) 1943 if ((num < 1) || (svr->delete_me))
@@ -2002,8 +2001,7 @@ _ecore_con_svr_udp_handler(void *data,
2002 &client_addr_len); 2001 &client_addr_len);
2003#endif 2002#endif
2004 2003
2005 if ((errno == EIO) || (errno == EBADF) || (errno == EPIPE) || 2004 if ((errno != EAGAIN) && (errno != EINTR))
2006 (errno == EINVAL) || (errno == ENOSPC) || (errno == ECONNREFUSED))
2007 { 2005 {
2008 if (!svr->delete_me) 2006 if (!svr->delete_me)
2009 { 2007 {
@@ -2106,7 +2104,7 @@ _ecore_con_svr_cl_read(Ecore_Con_Client *cl)
2106 { 2104 {
2107 errno = 0; 2105 errno = 0;
2108 num = read(cl->fd, buf, sizeof(buf)); 2106 num = read(cl->fd, buf, sizeof(buf));
2109 if ((num > 0) || (errno == EAGAIN)) 2107 if ((num > 0) || (errno == EAGAIN) || (errno == EINTR))
2110 lost_client = EINA_FALSE; 2108 lost_client = EINA_FALSE;
2111 } 2109 }
2112 else 2110 else
@@ -2257,8 +2255,8 @@ _ecore_con_server_flush(Ecore_Con_Server *svr)
2257 2255
2258 if (count < 0) 2256 if (count < 0)
2259 { 2257 {
2260 /* we lost our server! */ 2258 if ((errno != EAGAIN) && (errno != EINTR))
2261 _ecore_con_server_kill(svr); 2259 _ecore_con_server_kill(svr);
2262 return; 2260 return;
2263 } 2261 }
2264 2262
@@ -2304,29 +2302,27 @@ _ecore_con_client_flush(Ecore_Con_Client *cl)
2304 2302
2305 if (count < 0) 2303 if (count < 0)
2306 { 2304 {
2307 if ((errno == EIO) || (errno == EBADF) || (errno == EPIPE) || 2305 if ((errno != EAGAIN) && (errno != EINTR) && (!cl->delete_me))
2308 (errno == EINVAL) || (errno == ENOSPC) || (errno == ECONNREFUSED)) 2306 {
2309 if (!cl->delete_me) 2307 /* we lost our client! */
2310 { 2308 Ecore_Con_Event_Client_Del *e;
2311 /* we lost our client! */ 2309
2312 Ecore_Con_Event_Client_Del *e; 2310 e = calloc(1, sizeof(Ecore_Con_Event_Client_Del));
2313 2311 EINA_SAFETY_ON_NULL_RETURN(e);
2314 e = calloc(1, sizeof(Ecore_Con_Event_Client_Del)); 2312
2315 EINA_SAFETY_ON_NULL_RETURN(e); 2313 cl->event_count++;
2316 2314 _ecore_con_cl_timer_update(cl);
2317 cl->event_count++; 2315 e->client = cl;
2318 _ecore_con_cl_timer_update(cl); 2316 ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e,
2319 e->client = cl; 2317 _ecore_con_event_client_del_free, NULL);
2320 ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e, 2318
2321 _ecore_con_event_client_del_free, NULL); 2319 cl->dead = EINA_TRUE;
2322 2320 INF("Lost client %s", (cl->ip) ? cl->ip : "");
2323 cl->dead = EINA_TRUE; 2321 if (cl->fd_handler)
2324 INF("Lost client %s", (cl->ip) ? cl->ip : ""); 2322 ecore_main_fd_handler_del(cl->fd_handler);
2325 if (cl->fd_handler) 2323
2326 ecore_main_fd_handler_del(cl->fd_handler); 2324 cl->fd_handler = NULL;
2327 2325 }
2328 cl->fd_handler = NULL;
2329 }
2330 2326
2331 return; 2327 return;
2332 } 2328 }