Ejemplo n.º 1
0
static Eina_Bool
_ecore_con_local_win32_server_read_client_handler(void *data, Ecore_Win32_Handler *wh)
{
  Ecore_Con_Client *cl;
  void *buf;
  DWORD n;
  Eina_Bool broken_pipe = EINA_FALSE;

  cl = (Ecore_Con_Client *)data;

  if (!ResetEvent(cl->host_server->event_read))
    return ECORE_CALLBACK_RENEW;

  buf = malloc(cl->host_server->nbr_bytes);
  if (!buf)
    return ECORE_CALLBACK_RENEW;

  if (ReadFile(cl->host_server->pipe, buf, cl->host_server->nbr_bytes, &n, NULL))
    {
       if (!cl->delete_me)
         ecore_con_event_client_data(cl, buf, cl->host_server->nbr_bytes, EINA_FALSE);
       cl->host_server->want_write = 1;
    }
  else
    {
      if (GetLastError() == ERROR_BROKEN_PIPE)
        broken_pipe = EINA_TRUE;
    }

  if (broken_pipe)
    {
#if 0
       char *msg;

       msg = evil_last_error_get();
       if (msg)
         {
            ecore_con_event_client_error(cl, msg);
            free(msg);
         }
#endif
       if (!cl->delete_me)
         ecore_con_event_client_del(cl);
       cl->dead = EINA_TRUE;
       return ECORE_CALLBACK_CANCEL;
    }

  if (cl->host_server->want_write)
    ecore_con_local_win32_client_flush(cl);

   ecore_main_win32_handler_del(wh);

  return ECORE_CALLBACK_DONE;
}
Ejemplo n.º 2
0
static Eina_Bool
_ecore_con_local_win32_server_read_client_handler(void *data, Ecore_Win32_Handler *wh)
{
   Ecore_Con_Client *obj = data;
   Ecore_Con_Client_Data *cl = eo_data_scope_get(obj, ECORE_CON_CLIENT_CLASS);
   void *buf;
   DWORD n;
   Eina_Bool broken_pipe = EINA_FALSE;
   Ecore_Con_Server_Data *host_svr = eo_data_scope_get(cl->host_server, ECORE_CON_SERVER_CLASS);

   if (!ResetEvent(host_svr->event_read))
     return ECORE_CALLBACK_RENEW;

   buf = malloc(host_svr->nbr_bytes);
   if (!buf)
     return ECORE_CALLBACK_RENEW;

   if (ReadFile(host_svr->pipe, buf, host_svr->nbr_bytes, &n, NULL))
     {
        if (!cl->delete_me)
          ecore_con_event_client_data(obj, buf, host_svr->nbr_bytes, EINA_FALSE);
        host_svr->want_write = 1;
     }
   else
     {
        if (GetLastError() == ERROR_BROKEN_PIPE)
          broken_pipe = EINA_TRUE;
     }

   if (broken_pipe)
     {
#if 0
        char *msg;

        msg = evil_last_error_get();
        if (msg)
          {
             ecore_con_event_client_error(cl, msg);
             free(msg);
          }
#endif
        _ecore_con_client_kill(obj);
        return ECORE_CALLBACK_CANCEL;
     }

   if (host_svr->want_write)
     ecore_con_local_win32_client_flush(obj);

   ecore_main_win32_handler_del(wh);

   return ECORE_CALLBACK_DONE;
}