Beispiel #1
0
        static void DoServerSender(ClientInfo clientInfo, string[] args)
        {
            string   dir      = args[0];
            IOStream ioStream = clientInfo.IoStream;
            Options  options  = clientInfo.Options;

            if (options.verbose > 2)
            {
                Log.Write("Server sender starting");
            }
            if (options.amDaemon && config.ModuleIsWriteOnly(options.ModuleId))
            {
                MainClass.Exit("ERROR: module " + config.GetModuleName(options.ModuleId) + " is write only", clientInfo);
                return;
            }

            if (!options.relativePaths && !Util.pushDir(dir))
            {
                MainClass.Exit("Push_dir#3 " + dir + "failed", clientInfo);
                return;
            }

            FileList          fList    = new FileList(options);
            List <FileStruct> fileList = fList.sendFileList(clientInfo, args);

            if (options.verbose > 3)
            {
                Log.WriteLine("File list sent");
            }
            if (fileList.Count == 0)
            {
                MainClass.Exit("File list is empty", clientInfo);
                return;
            }
            ioStream.IOStartBufferingIn();
            ioStream.IOStartBufferingOut();

            Sender sender = new Sender(options);

            sender.SendFiles(fileList, clientInfo);
            ioStream.Flush();
            MainClass.Report(clientInfo);
            if (options.protocolVersion >= 24)
            {
                ioStream.readInt();
            }
            ioStream.Flush();
        }
Beispiel #2
0
        private static void DoServerSender(ClientInfo clientInfo, string[] args)
        {
            var dir      = args[0];
            var ioStream = clientInfo.IoStream;
            var options  = clientInfo.Options;

            if (options.Verbose > 2)
            {
                Log.Write("Server sender starting");
            }
            if (options.AmDaemon && Config.ModuleIsWriteOnly(options.ModuleId))
            {
                WinRsync.Exit("ERROR: module " + Config.GetModuleName(options.ModuleId) + " is write only", clientInfo);
                return;
            }

            if (!options.RelativePaths && !Util.PushDir(dir))
            {
                WinRsync.Exit("Push_dir#3 " + dir + "failed", clientInfo);
                return;
            }

            var fList    = new FileList(options);
            var fileList = fList.SendFileList(clientInfo, args);

            if (options.Verbose > 3)
            {
                Log.WriteLine("File list sent");
            }
            if (fileList.Count == 0)
            {
                WinRsync.Exit("File list is empty", clientInfo);
                return;
            }
            ioStream.IoStartBufferingIn();
            ioStream.IoStartBufferingOut();

            var sender = new Sender(options);

            sender.SendFiles(fileList, clientInfo);
            ioStream.Flush();
            WinRsync.Report(clientInfo);
            if (options.ProtocolVersion >= 24)
            {
                ioStream.ReadInt();
            }
            ioStream.Flush();
        }