ssh clag problems as long as you also fix the same problem in sshd
removed all the old read buffering code from io.c as this was only
there to try to reduce the chance of clagging up sshd.
clients when writing to a rsync server
it works like this:
- we have an extra pipe from the receiver to the generator
- the server always runs with multiplexing on
- errors from the generator go down the multiplexed connection
- errors from the receiver go over the pipe, and from there to
the multiplexed conn
it required some incredibly ugly code. damn.
situations:
1. the client is the receiver of files. Can't do it otherwise yet
because without -v the bytes written from the sender's generator
process will not be counted.
2. both the remote and local protocol versions are >=20. I did not
change the protocol version yet because it is such a minor change
that it isn't worth it, although I did test it with the protocol
version set to 20.
If neither of the situations hold, it prints a message saying to use -v.
was incorrect. It's hard to tell how many bytes are actually read because
transferring the value changes it and depending on its value it may
transfer 4 or 12 bytes so instead change the sender side to not include the
length of the counters it sends at all (it had been including one but three
are sent).
The reason for that is that on SVR2-based UTS 2.1.2 (which along with many
other old systems implements getcwd by forking "pwd") getcwd hangs when
called when other child processes are running.
I also added a quick return from push_dir if name == NULL so it doesn't
actually have to chdir anywhere when just initializing.
An initializing call to push_dir("/",0) had previously been put in at the
beginning of daemon_main() to avoid calling getcwd after a chroot, but
since that is no longer I needed I removed it and changed the call to
chdir("/") after chroot into a push_dir("/",0) so it will remember the
correct current directory.
Jason Andrade convinced me to add ftpd style logging of transfers,
enabled with a "transfer logging" option in rsyncd.conf
you can customise the format in log.c
to disable the use of chroot so rsync --daemon can be run as a non-root
user (if a non-privileged --port is used). The latter allows one to
specify a file in which to write the process id of the daemon, which is
useful when rsync --daemon is not run from inetd.
a daemon. This prevents library functions (such as getopt) stuffing up
our protocol stream when errors are detected.
- defer the error message from the options parsing until after the
socket is multiplexed. This allows clients sending new options which
the remote server doesn't understand to get a sensible error message.
there is then assume that the : is from a filename, not a host:dir
separator. This allows you to copy files with a : in them. (suggestion
from pfeifer@wait.de)
verbose info not being line buffered to files.
- add a call to localtime() in open_log() in order to prime the C
libraries timezone cache before the chroot(). This should fix the
problem of rsyncd log entries being in GMT time.
significant difference when the transport is ssh as ssh will otherwise
output a complete frame for each checksum record, which increases the
checksum data in size by a factor of around 4.
we no longer use non-blocking IO, instead it uses select a lot more,
being careful to always allow for reading whenever a valid read fd is
available and chcking timeouts.
also split the file io calls into fileio.c
messages from the server when using the socket code.
I've doen a fair bit of testing and I don't seem to have broken
anything, but it is a very complex change. More testing needed!