else
{
num = ecore_con_ssl_server_read(svr, buf, sizeof(buf));
- if (num > 0)
+ if (num >= 0)
lost_server = EINA_FALSE;
}
- if (lost_server)
- _ecore_con_server_kill(svr);
-
- if ((num > 0) && (!svr->delete_me))
+ if ((!svr->delete_me) && (num > 0))
{
Ecore_Con_Event_Server_Data *e;
_ecore_con_event_server_data_free, NULL);
}
-
+ if (lost_server)
+ _ecore_con_server_kill(svr);
}
static Eina_Bool
errno = 0;
num = read(svr->fd, buf, READBUFSIZ);
- if ((errno != EAGAIN) && (errno != EINTR))
- _ecore_con_server_kill(svr);
-
- if ((num < 1) || (svr->delete_me))
- return ECORE_CALLBACK_RENEW;
+ if ((!svr->delete_me) && (num > 0))
+ {
+ inbuf = malloc(num);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(inbuf, ECORE_CALLBACK_RENEW);
- inbuf = malloc(num);
- if (!inbuf)
- return ECORE_CALLBACK_RENEW;
+ memcpy(inbuf, buf, num);
- memcpy(inbuf, buf, num);
+ e = malloc(sizeof(Ecore_Con_Event_Server_Data));
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e, ECORE_CALLBACK_RENEW);
- e = calloc(1, sizeof(Ecore_Con_Event_Server_Data));
- EINA_SAFETY_ON_NULL_RETURN_VAL(e, ECORE_CALLBACK_RENEW);
+ svr->event_count++;
+ e->server = svr;
+ e->data = inbuf;
+ e->size = num;
+ ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e,
+ _ecore_con_event_server_data_free, NULL);
+ }
- svr->event_count++;
- e->server = svr;
- e->data = inbuf;
- e->size = num;
- ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e,
- _ecore_con_event_server_data_free, NULL);
+ if ((errno != EAGAIN) && (errno != EINTR))
+ _ecore_con_server_kill(svr);
return ECORE_CALLBACK_RENEW;
}
{ /* indent to keep it all nicely separated */
Ecore_Con_Event_Client_Add *add;
- add = calloc(1, sizeof(Ecore_Con_Event_Client_Add));
+ add = malloc(sizeof(Ecore_Con_Event_Client_Add));
EINA_SAFETY_ON_NULL_RETURN_VAL(add, ECORE_CALLBACK_RENEW);
/*cl->event_count++;*/
{
Ecore_Con_Event_Client_Data *e;
- e = calloc(1, sizeof(Ecore_Con_Event_Client_Data));
+ e = malloc(sizeof(Ecore_Con_Event_Client_Data));
EINA_SAFETY_ON_NULL_RETURN_VAL(e, ECORE_CALLBACK_RENEW);
svr->event_count++;
else
{
num = ecore_con_ssl_client_read(cl, buf, sizeof(buf));
- if (num > 0)
+ if (num >= 0)
lost_client = EINA_FALSE;
}
+ if ((!cl->delete_me) && (num > 0))
+ {
+ Ecore_Con_Event_Client_Data *e;
+
+ e = malloc(sizeof(Ecore_Con_Event_Client_Data));
+ EINA_SAFETY_ON_NULL_RETURN(e);
+
+ cl->event_count++;
+ _ecore_con_cl_timer_update(cl);
+ e->client = cl;
+ e->data = malloc(num);
+ if (!e->data)
+ {
+ ERR("alloc!");
+ free(e);
+ return;
+ }
+ memcpy(e->data, buf, num);
+ e->size = num;
+ ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e,
+ _ecore_con_event_client_data_free, NULL);
+ }
+
if (lost_client)
{
if (!cl->delete_me)
cl->fd_handler = NULL;
return;
}
-
- if ((num > 0) && (!cl->delete_me))
- {
- Ecore_Con_Event_Client_Data *e;
-
- e = malloc(sizeof(Ecore_Con_Event_Client_Data));
- EINA_SAFETY_ON_NULL_RETURN(e);
-
- cl->event_count++;
- _ecore_con_cl_timer_update(cl);
- e->client = cl;
- e->data = malloc(num);
- if (!e->data)
- {
- ERR("alloc!");
- free(e);
- return;
- }
- memcpy(e->data, buf, num);
- e->size = num;
- ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e,
- _ecore_con_event_client_data_free, NULL);
- }
-
-
}
static Eina_Bool