On Tue, Dec 04, 2001 at 09:01:15PM +0300, Alexander V. Lukyanov wrote: > On Mon, Dec 03, 2001 at 04:04:38PM -0500, Glenn Maynard wrote: > > I've added Fg, Bg, Suspend and Resume overrides to FileCopyPeerCLS, like > > those in MirrorJob, etc. This sets the priority correctly, and > > propagates suspends/resumes. I don't quite understand how the priority > > stuff works, and why I need to set it manually, but it works now. > > session with higher priority can steal connection from another session > with lower priority. That is foreground jobs have priority over > background jobs, so they set their sessions to higher priority.
That's what it looked like it was trying to do. The implementation is confusing, though: if(takeover_time!=NO_DATE && takeover_time+1-priority>now && connection_limit>0 && connection_limit<=CountConnections()+1) { TimeoutS(takeover_time+1-priority-now); goto notimeout_return; } Ths looks dependent on priority being 0 or 1; if priority is 0, it times out (in the common takeover_time == now) for one second (1-0); if 1 (high priority), 0 (the second conditional skips that, of course). If it was 2, it would be -1. (I don't see why lower priority jobs should time out longer; if a priority 5 job took over a priority 3 job, I'd think the delays would be the same.) Is there any place something like Fg() and Bg() could be added to SMTask? That way, creating an object you only need to know that you need to override Fg(), Bg(), Suspend() and Resume(), and call them on each object and on the parent class, rather than things like "Fg() in a job should call SetPriority(1)". > BTW, what do you think about caching in LsCache result of CHANGE_DIR? I didn't do this in the interests of not actually changing what was cached. That would cache more cases, though. If the "check the listings" method wasn't done, too, you'd add checks in cases where you have the parent directory cached, which is fairly common. ie. "cls; glob cls *". (Moderately contrived example; it's reasonable to anticipate GetFileInfo being used elsewhere, however.) I think it's useful to have protocol parsers readily available, though it doesn't matter to me if it's a FileAccess virtual or its own class. I used a class so there's a clean place to store things like "tz", so they don't have to be passed around so much; this would reduce maintenance in the FTP parsers if any further parameters become necessary; the rest followed from there. (In retrospect, it's probably not worth that much code.) Anyhow, with parsers easily available, this test is easy. -- Glenn Maynard