This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

IDX idle check up

Old posts that have not been replied to for several years.
Locked
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

IDX idle check up

Post by Ofloo »

when i open a socket i wana checkup idx after if its idle .. but it seems that everytime i checkup the idx it always gets the same idle time .. from what it started .. how is that so if i trigger the event (this proc kicks in few seconds later don't know why the delay tho but then it gets an idle time from euhm arround .. 8 - 13 seconds but once it has this idle time the idle time keeps the same like its on a keep alive or something ... if the first idel time = 8 seonds it always will be 8 seconds .. , if the idle time = 13 seconds it always remains 13 seconds .. ? ?

Code: Select all

proc idxidlecheck {idx} {
  if {[valididx $idx]} { 
    if {[getdccidle $idx] > 60} {
      killdcc $idx
    }
    after 5000
    idxidlecheck $idx
  } elseif {![valididx $idx]} {
   return 0
  }
}

also this loop bloks the script some how it freezes up i use the same time checkup interval to tail a file and it seems to work there so i wonder why it doesn't work here ..
XplaiN but think of me as stupid
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

I don't have time to explain how the world works, so here's the short version: Your eggdrop can't do anything else while waiting for your proc to return, so nothing else happens while you're waiting for the after to expire. You'll have to use an async method to do that second check. (timer/after(with 2 arguments)/time bind)
Have you ever read "The Manual"?
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

hmm what about the getdccidle ..? and how could i solve this problem .. most efficiently ?? i don't think using a while loop would be wize ..?
XplaiN but think of me as stupid
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Nobody said to use a while loop heh. All you have to do is change your call to after so that it calls the proc after 5 seconds asynchronously (i.e. not blocking for 5 seconds). Look it up in the tcl manual.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

hmm u mean liek utimer or something just initiate a timer to call up on the procedure and not use after to do so
XplaiN but think of me as stupid
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Ofloo wrote:hmm u mean liek utimer or something just initiate a timer to call up on the procedure and not use after to do so
The way you're using after in your proc is not comparable to using utimer. Calling after with one argument makes it block (halt all execution) at that point for the given number of milliseconds.
Have you ever read "The Manual"?
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

i know now tnx ;) makes sence .. hehe but didn't realize at the time being .. but tnx for the info makes a lot of sence why it would freeze
XplaiN but think of me as stupid
Locked