aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-11-25 08:15:39 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-11-25 08:15:39 +0000
commitf508f95f0e41c42abd238bbaf45d720d4ae6737b (patch)
tree7d4f4711a21e578abb933d74c5cb6faf4dd42f74
parent6e5a929ee85280017b2f9cd69de9697e22f21e4c (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
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.ja6
-rw-r--r--libsylph/session.c13
-rw-r--r--libsylph/session.h2
4 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1c6ae529..8e82d06e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2005-11-25
+ * libsylph/session.[ch]: session_read_data_as_file_cb(): don't write
+ to file until buffer is filled more than the half. Extended the
+ buffer size.
+
+2005-11-25
+
* libsylph/session.c: session_recv_data_as_file_idle_cb(): fixed a bug
that lost first part of message data.
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 9c5ea588..d4dccf5e 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,11 @@
2005-11-25
+ * libsylph/session.[ch]: session_read_data_as_file_cb(): バッファが
+ 半分以上満たされるまでファイルに書き出さないようにした。バッファ
+ サイズを拡大。
+
+2005-11-25
+
* libsylph/session.c: session_recv_data_as_file_idle_cb(): メッセージ
データの先頭部分を失うバグを修正。
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;