changeset 527:d0e8f8ee3b20

2004-8-9 Brian Masney <masneyb@gftp.org> * lib/options.h src/uicommon/gftpui.c - added ability to change the block size on the fly of the transfered files.
author masneyb
date Tue, 10 Aug 2004 02:09:00 +0000
parents 990088b18285
children d32b05e07284
files ChangeLog lib/options.h src/uicommon/gftpui.c
diffstat 3 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Aug 10 01:55:53 2004 +0000
+++ b/ChangeLog	Tue Aug 10 02:09:00 2004 +0000
@@ -1,4 +1,7 @@
 2004-8-9 Brian Masney <masneyb@gftp.org>
+	* lib/options.h src/uicommon/gftpui.c - added ability to change the
+	block size on the fly of the transfered files.
+
 	* lib/config_file.c lib/options.h lib/rfc959.c - fixed warnings about
 	unitialized members in the structure
 
@@ -2716,7 +2719,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.301 2004/08/10 01:55:52 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.302 2004/08/10 02:09:00 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/options.h	Tue Aug 10 01:55:53 2004 +0000
+++ b/lib/options.h	Tue Aug 10 02:09:00 2004 +0000
@@ -121,6 +121,11 @@
    GFTP_CVARS_FLAGS_SHOW_BOOKMARK,
    N_("The maximum KB/s a file transfer can get. (Set to 0 to disable)"),  
    GFTP_PORT_ALL, NULL},
+  {"trans_blksize", N_("Transfer Block Size:"), 
+   gftp_option_type_int, GINT_TO_POINTER(20480), NULL, 
+   GFTP_CVARS_FLAGS_SHOW_BOOKMARK,
+   N_("The block size that is used when transfering files. This should be a multiple of 1024."),  
+   GFTP_PORT_ALL, NULL},
 
   {"default_protocol", N_("Default Protocol:"),
    gftp_option_type_textcombo, "FTP", NULL, 0,
--- a/src/uicommon/gftpui.c	Tue Aug 10 01:55:53 2004 +0000
+++ b/src/uicommon/gftpui.c	Tue Aug 10 02:09:00 2004 +0000
@@ -1280,12 +1280,15 @@
 int
 gftpui_common_transfer_files (gftp_transfer * tdata)
 {
-  intptr_t preserve_permissions;
+  intptr_t preserve_permissions, trans_blksize;
   struct timeval updatetime;
   ssize_t num_read, ret;
   gftp_file * curfle; 
   int tofd, fromfd;
-  char buf[8192];
+  char *buf;
+
+  gftp_lookup_request_option (tdata->fromreq, "trans_blksize", &trans_blksize);
+  buf = g_malloc (trans_blksize);
 
   tdata->curfle = tdata->files;
   gettimeofday (&tdata->starttime, NULL);
@@ -1400,7 +1403,7 @@
 
           while (!tdata->cancel &&
                  (num_read = gftp_get_next_file_chunk (tdata->fromreq,
-                                                       buf, sizeof (buf))) > 0)
+                                                       buf, trans_blksize)) > 0)
             {
               gftp_calc_kbs (tdata, num_read);
               if (tdata->lasttime.tv_sec - updatetime.tv_sec >= 1 ||
@@ -1494,7 +1497,9 @@
       tdata->fromreq->cancel = 0;
       tdata->toreq->cancel = 0;
     }
+
   tdata->done = 1;
+  g_free (buf);
 
   return (1);
 }