diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-11-25 08:15:39 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-11-25 08:15:39 +0000 |
commit | f508f95f0e41c42abd238bbaf45d720d4ae6737b (patch) | |
tree | 7d4f4711a21e578abb933d74c5cb6faf4dd42f74 /libsylph | |
parent | 6e5a929ee85280017b2f9cd69de9697e22f21e4c (diff) |
session_read_data_as_file_cb(): don't write to file until buffer is filled more than the half.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@777 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/session.c | 13 | ||||
-rw-r--r-- | libsylph/session.h | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/libsylph/session.c b/libsylph/session.c index 77209c96..c73fe51d 100644 --- a/libsylph/session.c +++ b/libsylph/session.c @@ -775,10 +775,19 @@ static gboolean session_read_data_as_file_cb(SockInfo *source, if (data_begin_p > session->read_buf) { g_memmove(session->read_buf, data_begin_p, buf_data_len); - session->read_buf_p = - session->read_buf + buf_data_len; + data_begin_p = session->read_buf; + session->read_buf_p = session->read_buf + + session->preread_len; } g_print("buffer data (%d) <= PREREAD_SIZE\n", buf_data_len); + session->read_buf_p += session->read_buf_len; + session->preread_len = buf_data_len; + session->read_buf_len = 0; + return TRUE; + } + + if (READ_BUF_LEFT() >= (SESSION_BUFFSIZE / 2)) { + session->read_buf_p += session->read_buf_len; session->preread_len = buf_data_len; session->read_buf_len = 0; return TRUE; diff --git a/libsylph/session.h b/libsylph/session.h index 1bd948eb..d9cc3fdb 100644 --- a/libsylph/session.h +++ b/libsylph/session.h @@ -31,7 +31,7 @@ #include "socket.h" -#define SESSION_BUFFSIZE 4096 +#define SESSION_BUFFSIZE 8192 typedef struct _Session Session; |