maybe just adding

/**
* @since 1.3
*/

would be nice, just to know when it is added

Vincent

On Thu, May 24, 2012 at 9:49 AM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> and no more segv's in ecore-con and ecore-ipc. see changelog.
>
>
>
> Author:       raster
> Date:         2012-05-24 00:49:30 -0700 (Thu, 24 May 2012)
> New Revision: 71400
> Trac:         http://trac.enlightenment.org/e/changeset/71400
>
> Modified:
>  trunk/ecore/ChangeLog trunk/ecore/src/lib/ecore_con/Ecore_Con.h 
> trunk/ecore/src/lib/ecore_con/ecore_con.c 
> trunk/ecore/src/lib/ecore_con/ecore_con_private.h 
> trunk/ecore/src/lib/ecore_ipc/ecore_ipc.c
>
> Modified: trunk/ecore/ChangeLog
> ===================================================================
> --- trunk/ecore/ChangeLog       2012-05-24 07:17:05 UTC (rev 71399)
> +++ trunk/ecore/ChangeLog       2012-05-24 07:49:30 UTC (rev 71400)
> @@ -662,3 +662,13 @@
>  2012-05-24 Doyoun Kang
>
>         * Add Ecore_X_Error_Code enumeration in ecore_x
> +
> +2012-05-24 Carsten Haitzler (The Rasterman)
> +
> +        * Add ecore_con_client_ref() and ecore_con_client_unref()
> +        * Fix ecore_con to obey reference counting for con clients
> +        * Fix lurking bug in ecore_ipc that had it be able to crash in
> +        accessind already deleted ecore-con clients. use client
> +        ref/unref to fix it. No backport of this fix as it requires a
> +        new feature.
> +
>
> Modified: trunk/ecore/src/lib/ecore_con/Ecore_Con.h
> ===================================================================
> --- trunk/ecore/src/lib/ecore_con/Ecore_Con.h   2012-05-24 07:17:05 UTC (rev 
> 71399)
> +++ trunk/ecore/src/lib/ecore_con/Ecore_Con.h   2012-05-24 07:49:30 UTC (rev 
> 71400)
> @@ -1240,9 +1240,29 @@
>  * Use this function to return the port on which a given client has connected.
>  */
>  EAPI int               ecore_con_client_port_get(Ecore_Con_Client *cl);
> +/**
> + * @brief increment the references on a connection client
> + *
> + * @param cl The client
> + * This increases the references on the given client to keep it alive in
> + * memory for longer until all references are release by
> + * ecore_con_client_unref().
> + * @since 1.3
> + */
> +EAPI void              ecore_con_client_ref(Ecore_Con_Client *cl);
> +/**
> + * @brief decrement the references on a connection client
> + *
> + * @param cl The client
> + * This decrements the references on the given client and once references hit
> + * 0, the client is deleted. ecore_con_client_del() does the same thing as
> + * ecore_con_client_unref(). All con clients start with a reference count of
> + * 1.
> + * @since 1.3
> + */
> +EAPI void              ecore_con_client_unref(Ecore_Con_Client *cl);
>
>
> -
>  /**
>  * @}
>  */
>
> Modified: trunk/ecore/src/lib/ecore_con/ecore_con.c
> ===================================================================
> --- trunk/ecore/src/lib/ecore_con/ecore_con.c   2012-05-24 07:17:05 UTC (rev 
> 71399)
> +++ trunk/ecore/src/lib/ecore_con/ecore_con.c   2012-05-24 07:49:30 UTC (rev 
> 71400)
> @@ -116,9 +116,12 @@
>      }
>    INF("Lost client %s", (cl->ip) ? cl->ip : "");
>    if (cl->fd_handler)
> -     ecore_main_fd_handler_del(cl->fd_handler);
> -
> -   cl->fd_handler = NULL;
> +     {
> +        ecore_main_fd_handler_del(cl->fd_handler);
> +        cl->fd_handler = NULL;
> +     }
> +   if (cl->ref <= 0)
> +     _ecore_con_client_free(cl);
>  }
>
>  void
> @@ -130,9 +133,10 @@
>      ecore_con_event_server_del(svr);
>
>    if (svr->fd_handler)
> -     ecore_main_fd_handler_del(svr->fd_handler);
> -
> -   svr->fd_handler = NULL;
> +     {
> +        ecore_main_fd_handler_del(svr->fd_handler);
> +        svr->fd_handler = NULL;
> +     }
>  }
>
>  #define _ecore_con_server_kill(svr) do { \
> @@ -867,12 +871,35 @@
>         ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_del");
>         return NULL;
>      }
> -
> -   _ecore_con_client_kill(cl);
> +   ecore_con_client_unref(cl);
>    return cl->data;
>  }
>
>  EAPI void
> +ecore_con_client_ref(Ecore_Con_Client *cl)
> +{
> +   if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
> +     {
> +        ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_ref");
> +        return;
> +     }
> +   cl->ref++;
> +}
> +
> +EAPI void
> +ecore_con_client_unref(Ecore_Con_Client *cl)
> +{
> +   if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT))
> +     {
> +        ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, 
> "ecore_con_client_unref");
> +        return;
> +     }
> +   cl->ref--;
> +   if (cl->ref <= 0)
> +     _ecore_con_client_kill(cl);
> +}
> +
> +EAPI void
>  ecore_con_client_data_set(Ecore_Con_Client *cl,
>                           const void       *data)
>  {
> @@ -1834,6 +1861,7 @@
>         return ECORE_CALLBACK_RENEW;
>      }
>    cl->host_server = svr;
> +   cl->ref = 1;
>
>    client_addr_len = sizeof(client_addr);
>    memset(&client_addr, 0, client_addr_len);
> @@ -2383,7 +2411,7 @@
>                _ecore_con_server_free(svr);
>           }
>         if (!e->client->event_count)
> -          _ecore_con_client_free(e->client);
> +          ecore_con_client_del(e->client);
>      }
>    ecore_con_event_client_del_free(e);
>    _ecore_con_event_count--;
>
> Modified: trunk/ecore/src/lib/ecore_con/ecore_con_private.h
> ===================================================================
> --- trunk/ecore/src/lib/ecore_con/ecore_con_private.h   2012-05-24 07:17:05 
> UTC (rev 71399)
> +++ trunk/ecore/src/lib/ecore_con/ecore_con_private.h   2012-05-24 07:49:30 
> UTC (rev 71400)
> @@ -119,6 +119,7 @@
>    SSL *ssl;
>    int ssl_err;
>  #endif
> +   int ref;
>    Ecore_Con_Ssl_State ssl_state;
>    Eina_Bool handshaking : 1;
>    Eina_Bool upgrade : 1; /* STARTTLS queued */
>
> Modified: trunk/ecore/src/lib/ecore_ipc/ecore_ipc.c
> ===================================================================
> --- trunk/ecore/src/lib/ecore_ipc/ecore_ipc.c   2012-05-24 07:17:05 UTC (rev 
> 71399)
> +++ trunk/ecore/src/lib/ecore_ipc/ecore_ipc.c   2012-05-24 07:49:30 UTC (rev 
> 71400)
> @@ -881,7 +881,7 @@
>    if (cl->event_count == 0)
>      {
>         svr = 
> ecore_con_server_data_get(ecore_con_client_server_get(cl->client));
> -        ecore_con_client_del(cl->client);
> +        ecore_con_client_unref(cl->client);
>         svr->clients = eina_list_remove(svr->clients, cl);
>         if (cl->buf) free(cl->buf);
>         ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE);
> @@ -1034,6 +1034,7 @@
>         svr = 
> ecore_con_server_data_get(ecore_con_client_server_get(e->client));
>         ECORE_MAGIC_SET(cl, ECORE_MAGIC_IPC_CLIENT);
>         cl->client = e->client;
> +        ecore_con_client_ref(cl->client);
>         cl->max_buf_size = 32 * 1024;
>         ecore_con_client_data_set(cl->client, (void *)cl);
>         svr->clients = eina_list_append(svr->clients, cl);
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to