示例#1
0
文件: Daemon.cs 项目: vmas/rsync.net
        public static void DoServerReceive(ClientInfo cInfo, string[] args)
        {
            Options  options = cInfo.Options;
            IOStream f       = cInfo.IoStream;

            if (options.verbose > 2)
            {
                Log.Write("Server receive starting");
            }
            if (options.amDaemon && config.ModuleIsReadOnly(options.ModuleId))
            {
                MainClass.Exit("ERROR: module " + config.GetModuleName(options.ModuleId) + " is read only", cInfo);
                return;
            }

            f.IOStartBufferingIn();
            if (options.deleteMode && !options.deleteExcluded)
            {
                Exclude excl = new Exclude(options);
                excl.ReceiveExcludeList(f);
            }

            FileList          fList    = new FileList(cInfo.Options);
            List <FileStruct> fileList = fList.receiveFileList(cInfo);

            DoReceive(cInfo, fileList, null);
        }
示例#2
0
		public int ClientRun(ClientInfo cInfo, int pid, string[] args)
		{
			Options options = cInfo.Options;
			IOStream f = cInfo.IoStream;
			FileList fList;
			ArrayList fileList;			

			MainClass.SetupProtocol(cInfo);
			if(options.protocolVersion >= 23 && !options.readBatch)
				f.IOStartMultiplexIn();
			if(options.amSender)
			{				
				f.IOStartBufferingOut();	
				
				if (options.deleteMode && !options.deleteExcluded)
				{
					Exclude excl = new Exclude(options);
					excl.SendExcludeList(f);
				}

				if (options.verbose > 3)
					Log.Write("File list sent\n");
				f.Flush();
				fList = new FileList(options);
				fileList = fList.sendFileList(cInfo, args);
				if(options.verbose > 3)
					Log.WriteLine("file list sent");
				f.Flush();
				Sender sender = new Sender(options);
				sender.SendFiles(fileList, cInfo);
				f.Flush();
				f.writeInt(-1);
				return -1;
			}						
			options.dir = args[0];
			if(options.dir.CompareTo("") != 0 && options.dir.IndexOf(':') == -1)
			{
				if(options.dir[0] == '/')
					options.dir = "c:" + options.dir;
				else  if(options.dir.IndexOf('/') != -1)
				{
					options.dir = options.dir.Insert(options.dir.IndexOf('/') - 1,":");
				}
			} 
			if(!options.readBatch)
			{
				Exclude excl = new Exclude(options);
				excl.SendExcludeList(f);
			}
			fList = new FileList(options);
			fileList = fList.receiveFileList(cInfo);			
			return Daemon.DoReceive(cInfo,fileList,null);			
		}
示例#3
0
        public int ClientRun(ClientInfo clientInfo, int pid, string[] args)
        {
            Options           options  = clientInfo.Options;
            IOStream          ioStream = clientInfo.IoStream;
            FileList          fList;
            List <FileStruct> fileList;

            MainClass.SetupProtocol(clientInfo);
            if (options.protocolVersion >= 23 && !options.readBatch)
            {
                ioStream.IOStartMultiplexIn();
            }
            if (options.amSender)
            {
                ioStream.IOStartBufferingOut();

                if (options.deleteMode && !options.deleteExcluded)
                {
                    Exclude 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();
                Sender sender = new Sender(options);
                sender.SendFiles(fileList, clientInfo);
                ioStream.Flush();
                ioStream.writeInt(-1);
                return(-1);
            }
            options.dir = args[0];
            if (options.dir.CompareTo(String.Empty) != 0 && options.dir.IndexOf(':') == -1)
            {
                if (options.dir[0] == '/')
                {
                    options.dir = "c:" + options.dir;
                }
                else if (options.dir.IndexOf('/') != -1)
                {
                    options.dir = options.dir.Insert(options.dir.IndexOf('/') - 1, ":");
                }
            }
            if (!options.readBatch)
            {
                Exclude excl = new Exclude(options);
                excl.SendExcludeList(ioStream);
            }
            fList    = new FileList(options);
            fileList = fList.receiveFileList(clientInfo);
            return(Daemon.DoReceive(clientInfo, fileList, null));
        }
示例#4
0
        public static void DoServerReceive(ClientInfo cInfo, string[] args)
        {
            Options options = cInfo.Options;
            IOStream f = cInfo.IoStream;
            if (options.verbose > 2)
            {
                Log.Write("Server receive starting");
            }
            if (options.amDaemon && config.ModuleIsReadOnly(options.ModuleId))
            {
                MainClass.Exit("ERROR: module " + config.GetModuleName(options.ModuleId) + " is read only", cInfo);
                return;
            }

            f.IOStartBufferingIn();
            if (options.deleteMode && !options.deleteExcluded)
            {
                Exclude excl = new Exclude(options);
                excl.ReceiveExcludeList(f);
            }

            FileList fList = new FileList(cInfo.Options);
            List<FileStruct> fileList = fList.receiveFileList(cInfo);
            DoReceive(cInfo, fileList, null);
        }