[Patch] Addon to 'Fish uploads slowly' patch -- better fallback
- From: buc <buc odusz so-cdu ru>
- To: mc-devel gnome org
- Subject: [Patch] Addon to 'Fish uploads slowly' patch -- better fallback
- Date: Tue, 30 Nov 2004 20:32:09 +0300
Hi,
It is an addition to previously posted patch which solve too slow FISH
uploads (" head || dd " )
Possible, I have found a better way for fallback. It is several times
faster than initial
"dd bs=1 count=%lu" ...
The idea is we use shell loop as this:
while :
do
set @@@ `ls -l <filename>`
[ $6 -lt <size> ] && dd bs=4096 count=1 || break
done
Note: `@@@' is ised to avoid "option-like" interpretation of `ls' output.
Each invokation `dd' reads only once ("count=1"), with maximum amount
of 4096 bytes. Actually, reading occurs in smaller portions - as `ssh'
put data in the pipe.
We never read the extra data because MC do not give us anything more
until we echo status code to it.
This way successfully tested by us in the GNU/non-GNU environment.
The patch attached, it should be applied after previous posted patch.
--
Dmitry Butskoj <Dmitry Butskoj name>
Saint-Petersburg, Russia
Red Hat Certified Engineer 809003662809495
diff -Nrbu mc-4.6.1-20041108/vfs/fish.c mc-4.6.1-20041108-OK/vfs/fish.c
--- mc-4.6.1-20041108/vfs/fish.c 2004-11-30 19:17:22.000000000 +0300
+++ mc-4.6.1-20041108-OK/vfs/fish.c 2004-11-30 19:05:55.000000000 +0300
@@ -521,26 +521,34 @@
"> /%s\n"
"echo '### 001'\n"
"(\n"
- "head -c %lu -q - || dd bs=1 count=%lu\n"
+ "head -c %lu -q - || while : \n"
+ "do\n"
+ "set @@@ `ls -l /%s`\n"
+ "[ $6 -lt %lu ] && dd bs=4096 count=1 || break\n"
+ "done\n"
") 2>/dev/null | (\n"
"cat > /%s\n"
"cat > /dev/null\n"
"); echo '### 200'\n",
(unsigned long) s.st_size, name, quoted_name,
- (unsigned long) s.st_size,
+ (unsigned long) s.st_size, quoted_name,
(unsigned long) s.st_size, quoted_name);
else
n = fish_command (me, super, WAIT_REPLY,
"#STOR %lu /%s\n"
"echo '### 001'\n"
"(\n"
- "head -c %lu -q - || dd bs=1 count=%lu\n"
+ "head -c %lu -q - || while : \n"
+ "do\n"
+ "set @@@ `ls -l /%s`\n"
+ "[ $6 -lt %lu ] && dd bs=4096 count=1 || break\n"
+ "done\n"
") 2>/dev/null | (\n"
"cat >> /%s\n"
"cat > /dev/null\n"
"); echo '### 200'\n",
(unsigned long) s.st_size, name,
- (unsigned long) s.st_size,
+ (unsigned long) s.st_size, quoted_name,
(unsigned long) s.st_size, quoted_name);
g_free (quoted_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]