View Single Post
Old 01-06-2004, 03:44 AM  
FTPServerTools
Senior Member
 
Join Date: Sep 2002
Posts: 543
Default

I dont think that that is so hard. Using the following defenitions:
RACE=x or more users in the same dir and uploading
RACE COMPLETE=completion tag available
RACE PASSED=last file uploaded from race>y minutes ago or race dir created y minutes ago
KICK=immediate removal frmo the site

now loop in a who loop, so say once every 10 seconds in a timer loop. So since there is no timer available in the tcl script you would need an external program to start the thing OR you need to put it on the file download trigger (preferred solution if you use tcl).
Assuming you take the STOR pre command:
Find race occuring:
Code:
for all connections to io do
  store user,connection,path,action in the who_list
for all connection(i) in the who_list
  for all connection(j) in the who_list
    if i!=j and action(i)==uploading and action(j)==uploading and path(i)==path(j) then {
      race=TRUE;
      racepath(i)=path(i);
    }
  next j
next i

if (race) then
  store(race,now)
  for all action(i) do
    if action(i)!=uploading then kill connection(i)   //simple kill all leechers or alternatively use sitekill transfer=down
  next i    
end if

Put on the post STOR command:
for all connections to io do
  store user,connection,path,action in the who_list
race=false
for all connections to io do
  if action(i)=uploading and completiontag(path(i)) then race=true
store(race,now)


Put on the RETR pre command to disallow RETR during a race.
fetch(race)
fetch(racestart)
if race and now-racestart>x minutes then return not allowed
race=false
store(race,now)


Alternatively as extra:
Put on the LOGIN pre command to disallow LOGIN during a race.
fetch(race)
fetch(racestart)
if race and now-racestart>x minutes then return not allowed
race=false
store(race,now)

Now simply convert this stuff to itcl or an external C program and you got your script.
FTPServerTools is offline   Reply With Quote