ecore_con - Fix binary buffer when using ECORE_CON_REMOTE_UDP.

ERR<7807>: lib/eina/eina_binbuf_template_c.x:95 eina_binbuf_append_length() *** Eina Magic Check Failed !!!
This fix a problem where eina_binbuf was used without
calling eina_binbuf_new when ECORE_CON_REMOTE_UDP is used.
This commit is contained in:
Nicolas Aguirre 2014-01-03 18:57:56 +01:00 committed by Guillaume Friloux
parent d31f21a288
commit 503e7a5b03
1 changed files with 14 additions and 12 deletions

View File

@ -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)) 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, sendto(cl->host_server->fd, data, size, 0, (struct sockaddr *)cl->client_addr,
cl->client_addr_len); cl->client_addr_len);
else if (!cl->buf) else
{ {
cl->buf = eina_binbuf_new(); if (!cl->buf)
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; cl->buf = eina_binbuf_new();
if (setsockopt(cl->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0) EINA_SAFETY_ON_NULL_RETURN_VAL(cl->buf, 0);
/* realistically this isn't anything serious so we can just log and continue */ #ifdef TCP_CORK
ERR("corking failed! %s", strerror(errno)); 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 #endif
}
eina_binbuf_append_length(cl->buf, data, size);
} }
eina_binbuf_append_length(cl->buf, data, size);
return size; return size;
} }