Hi All,
I am trying to see the rsync source code. I could see that there are main
three processes: I realize that Server or Client becomes Sender or Receiver
based on arguments provided.
1. Daemon
start_daemon : clientserver.c
2. Server
if(sender) {
call recv_filter_list : exclude.c
call send_file_list : flist.c
call send_files : sender.c
} else {
call recv_filter_list : exlude.c
call recv_file_list : flist.c
call do_recv : main.c
call recv_files : receiver.c
call generate files : generator.c
}
3. Client
call do_cmd : main.c
call client_run : main.c
if(sender) {
call send_filter_list : exclude.c
call send_file_list : flist.c
call send_files : sender.c
} else {
call send_filter_list : exclude.c
call recv_file_list : flist.c
call do_recv : main.c
call recv_files : receiver.c call generate files :
generator.c
}
I have noticed that deamon process will start only if am_daemon argument
provided. My questions are
1. What is the roll of deamon process. How it different from server? Does it
run always on remote machine? When I do rsync from client how remote
deamon/server will get triggered?
2 .Where the arguments are being set. I cannot see any of arguments(like
am_server, am_deamon etc) is being set anywhere.
Please help me on this so that I can proceed.
Thanks,
Jignesh
-------------- next part --------------
HTML attachment scrubbed and removed
On Mon, 2008-12-15 at 10:14 +0530, Jignesh Shah wrote:> I am trying to see the rsync source code. I could see that there are > main three processes: I realize that Server or Client becomes Sender > or Receiver based on arguments provided.> 1. What is the roll of deamon process. How it different from server? > Does it run always on remote machine? When I do rsync from client how > remote deamon/server will get triggered?In the context of rsync, the server is simply the rsync process that is accessed on the user's behalf to handle one end of the transfer: the remote end if there is one, or otherwise (arbitrarily) the destination. A daemon is a server with some extra features controlled by a configuration file: it limits clients to accessing areas of the filesystem defined as "modules", and it can optionally listen on a port for any number of client connections (which it handles individually). An rsync client can fork a server locally, invoke a plain server over remote shell, connect to a listening daemon, or invoke a single-use daemon over remote shell. In the last two cases, rsync carries out a "daemon protocol" before the main transfer protocol begins. (Now that I've taken the time to write a complete, concise explanation, maybe it will eventually find its way into my revised man page.)> 2 .Where the arguments are being set. I cannot see any of > arguments(like am_server, am_deamon etc) is being set anywhere.They are set from the --daemon and --server command-line arguments. "git grep" is your friend: rsync $ git grep -E -n 'am_(server|daemon) =' cleanup.c:110: am_server = 2; clientserver.c:773: am_server = 1; /* Don't let someone try to be tricky. */ options.c:79:int am_server = 0; options.c:100:int am_daemon = 0; options.c:1305: am_server = 1; options.c:1386: am_daemon = 1; pipe.c:135: am_server = 1; -- Matt
Reasonably Related Threads
- Differentiating debug messages from both sides
- Prevent infinite recursion in rwrite()
- [PATCH] Batch-mode rewrite
- rsync error using ssh : @ERROR: access denied to server.domain.com from unknown (0.0.0.0) {Scanned By MailScanner}
- patch to enable faster mirroring of large filesystems