Пример #1
0
        public static void DoServerReceive(ClientInfo cInfo, string[] args)
        {
            var options = cInfo.Options;
            var f       = cInfo.IoStream;

            if (options.Verbose > 2)
            {
                Log.Write("Server receive starting");
            }
            if (options.AmDaemon && Config.ModuleIsReadOnly(options.ModuleId))
            {
                WinRsync.Exit("ERROR: module " + Config.GetModuleName(options.ModuleId) + " is read only", cInfo);
                return;
            }

            f.IoStartBufferingIn();
            if (options.DeleteMode && !options.DeleteExcluded)
            {
                var excl = new Exclude(options);
                excl.ReceiveExcludeList(f);
            }

            var fList    = new FileList(cInfo.Options);
            var fileList = fList.ReceiveFileList(cInfo);

            DoReceive(cInfo, fileList, null);
        }
Пример #2
0
        public int ClientRun(ClientInfo clientInfo, int pid, string[] args)
        {
            var               options  = clientInfo.Options;
            var               ioStream = clientInfo.IoStream;
            FileList          fList;
            List <FileStruct> fileList;

            WinRsync.SetupProtocol(clientInfo);
            if (options.ProtocolVersion >= 23 && !options.ReadBatch)
            {
                ioStream.IoStartMultiplexIn();
            }
            if (options.AmSender)
            {
                ioStream.IoStartBufferingOut();

                if (options.DeleteMode && !options.DeleteExcluded)
                {
                    var excl = new Exclude(options);
                    excl.SendExcludeList(ioStream);
                }

                if (options.Verbose > 3)
                {
                    Log.Write("File list sent\n");
                }
                ioStream.Flush();
                fList    = new FileList(options);
                fileList = fList.SendFileList(clientInfo, args);
                if (options.Verbose > 3)
                {
                    Log.WriteLine("file list sent");
                }
                ioStream.Flush();
                var sender = new Sender(options);
                sender.SendFiles(fileList, clientInfo);
                ioStream.Flush();
                ioStream.WriteInt(-1);
                return(-1);
            }
            options.Dir = args[0];
            options.Dir = Path.GetFullPath(options.Dir ?? string.Empty);

            if (!options.ReadBatch)
            {
                var excl = new Exclude(options);
                excl.SendExcludeList(ioStream);
            }
            fList    = new FileList(options);
            fileList = fList.ReceiveFileList(clientInfo);
            return(Daemon.DoReceive(clientInfo, fileList, null));
        }