This patch fix a problem when using ecore_con with UDP

Eina_bin_buf is called without calling eina_binbuf_new, resulting with
the following warning :
lib/eina/eina_binbuf_template_c.x:95 eina_binbuf_append_length() ***
Eina Magic Check Failed !!

SPANK SPANK SPANK

{F7205}

PS : i should be stupid, but i can't connect to phab. So i send the
patch here ....

-- 
Nicolas Aguirre
Mail: [email protected]
Web: http://enna.geexbox.org
Blog: http://dev.enlightenment.fr/~captainigloo/
From 4840baef76db4374da5bc1c1723b75c56db8d9af Mon Sep 17 00:00:00 2001
From: Nicolas Aguirre <[email protected]>
Date: Fri, 3 Jan 2014 17:38:15 +0100
Subject: [PATCH] Fix warning in ecore_con. ERR<7807>:
 lib/eina/eina_binbuf_template_c.x:95 eina_binbuf_append_length() *** Eina
 Magic Check Failed !!! This fix a problemm where eina_binbuf was used without
 calling eina_binbuf_new when ECORE_CON_REMOTE_UDP is used.

---
 src/lib/ecore_con/ecore_con.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index 33f6f77..5813956 100644
--- a/src/lib/ecore_con/ecore_con.c
+++ b/src/lib/ecore_con/ecore_con.c
@@ -799,22 +799,24 @@ ecore_con_client_send(Ecore_Con_Client *cl,
    if (cl->host_server && ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP))
      sendto(cl->host_server->fd, data, size, 0, (struct sockaddr *)cl->client_addr,
             cl->client_addr_len);
-   else if (!cl->buf)
+   else 
      {
-        cl->buf = eina_binbuf_new();
-        EINA_SAFETY_ON_NULL_RETURN_VAL(cl->buf, 0);
-#ifdef TCP_CORK
-        if ((cl->fd >= 0) && ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK))
+        if (!cl->buf)
           {
-             int state = 1;
-             if (setsockopt(cl->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
-               /* realistically this isn't anything serious so we can just log and continue */
-               ERR("corking failed! %s", strerror(errno));
-          }
+             cl->buf = eina_binbuf_new();
+             EINA_SAFETY_ON_NULL_RETURN_VAL(cl->buf, 0);
+#ifdef TCP_CORK
+             if ((cl->fd >= 0) && ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK))
+               {
+                  int state = 1;
+                  if (setsockopt(cl->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
+                    /* realistically this isn't anything serious so we can just log and continue */
+                    ERR("corking failed! %s", strerror(errno));
+               }
 #endif
+          }
+        eina_binbuf_append_length(cl->buf, data, size);
      }
-   eina_binbuf_append_length(cl->buf, data, size);
-
    return size;
 }
 
-- 
1.8.3.2

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to