I'm using rsync in my own C++ program by issueing the command
system("rsync -rauzvq root@host:/folder");
I use this for keeping multiple systems in sync.
Now I have the problem that when a remote host shuts off and there it was still rsync-ing with my program, my program hangs for the period of the TCP timeout. So I thought, I would adjust the TCP timeout parameter for the rsync socket, but I can't figure out how (--sockopts isn't working).
Another way of fixing this would involve making a forked system call and check whether the rsync pID still exists after a certain timeout, otherwise kill it. Only downside on this is that I can't check whether the process is genuinely syncing or just hanging on a TCP timeout?
So, what would you guys try?