Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_con
Modified Files:
ecore_con.c ecore_con_private.h
Log Message:
hmmm - why read_buf is in the struct so each server and client connection
PERMENANTLY uses 64kb of ram until closed? why? trill???? why does ssl need a
malloced buffer and cannot a buffer on the stack?
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_con/ecore_con.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- ecore_con.c 20 Apr 2004 09:32:57 -0000 1.23
+++ ecore_con.c 20 Apr 2004 11:40:44 -0000 1.24
@@ -664,6 +664,7 @@
#endif
if (svr->name) free(svr->name);
if (svr->path) free(svr->path);
+ if (svr->read_buf) free(svr->read_buf);
if (svr->fd_handler) ecore_main_fd_handler_del(svr->fd_handler);
free(svr);
}
@@ -821,6 +822,9 @@
if (!svr->ssl)
{
#endif
+ /* FIXME: why is read_buf in the server struct now??? */
+ /* yes play nice with ssl - WHY? */
+ if (!svr->read_buf) svr->read_buf = malloc(READBUFSIZ);
if ((num = read(svr->fd, svr->read_buf, READBUFSIZ)) < 1)
lost_server = (errno == EIO || errno == EBADF ||
errno == EPIPE || errno == EINVAL ||
@@ -829,6 +833,7 @@
}
else
{
+ if (!svr->read_buf) svr->read_buf = malloc(READBUFSIZ);
num = SSL_read(svr->ssl, svr->read_buf, READBUFSIZ);
if (num < 1)
{
@@ -870,6 +875,11 @@
svr->dead = 1;
ecore_main_fd_handler_del(svr->fd_handler);
svr->fd_handler = NULL;
+ if (svr->read_buf)
+ {
+ free(svr->read_buf);
+ svr->read_buf = NULL;
+ }
return 1;
}
break;
@@ -898,16 +908,35 @@
{
#endif
if (!svr_try_connect(svr))
- return 1;
+ {
+ if (svr->read_buf)
+ {
+ free(svr->read_buf);
+ svr->read_buf = NULL;
+ }
+ return 1;
+ }
#if USE_OPENSSL
}
else if ((svr_try_connect_ssl(svr)) && (!svr_try_connect(svr)))
- return 1;
+ {
+ if (svr->read_buf)
+ {
+ free(svr->read_buf);
+ svr->read_buf = NULL;
+ }
+ return 1;
+ }
#endif
}
_ecore_con_server_flush(svr);
}
+ if (svr->read_buf)
+ {
+ free(svr->read_buf);
+ svr->read_buf = NULL;
+ }
return 1;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_con/ecore_con_private.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ecore_con_private.h 3 Apr 2004 15:03:33 -0000 1.4
+++ ecore_con_private.h 20 Apr 2004 11:40:44 -0000 1.5
@@ -57,7 +57,7 @@
char connecting : 1;
/* put the read buffer here to play nice with OpenSSL */
- unsigned char read_buf[READBUFSIZ];
+ unsigned char *read_buf;
#if USE_OPENSSL
SSL_CTX *ssl_ctx;
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs