mIRC Home    About    Download    Register    News    Help

Print Thread
on sockclose called twice if slow #52050 30/09/03 08:03 PM
Joined: Sep 2003
Posts: 38
O
Olathe Offline OP
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Sep 2003
Posts: 38
if an on sockclose event takes a long time to execute, it will be called twice, possibly leading to errors when the event isn't designed to run twice in a row.


alias test sockopen test www.yahoo.com 80
on *:sockopen:test:{
sockwrite -tn test GET / HTTP/1.0
sockwrite -t test $str($crlf, 2)
}
on *:sockclose:test:{
TestAsk
}
alias -l TestAsk echo 4 -a $?


The use of an alias to use $? is just to make a short, easy-to-understand example.

Re: on sockclose called twice if slow #52051 30/09/03 09:34 PM
Joined: Feb 2003
Posts: 810
C
cold Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Confirmed here.


* cold edits his posts 24/7
Re: on sockclose called twice if slow #52052 01/10/03 07:24 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
How long a time are you talking about? I couldn't reproduce this (WinXP) so I added a little to the code to show time taken

on *:sockclose:test:{
set -u %testask $ticks
TestAsk
}
alias -l TestAsk echo 4 -a $? - $calc(($ticks - %testask)*.001) seconds.

These are the results, there were no doubleups.
how long? - 10.797 seconds.
a bit longer.... - 19.938 seconds.
shorter - 1.156 seconds.
long enough yet? 27.921 seconds.


Re: on sockclose called twice if slow #52053 01/10/03 10:31 AM
Joined: Dec 2002
Posts: 349
S
Skip Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 349
I think this is an issue with mIRC allowing $? to be used in the event, the help file makes it very clear that $?/$input can not be used during a script event.

Are you able to reproduce the bug without $? ?

Re: on sockclose called twice if slow #52054 01/10/03 10:57 AM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
This bug also occured to me when I tested my /sleep and /xrun, that use a COM object to delay mIRC, before submitting them to ms.org. This is the note I eventually added, to inform users of this behavior:
  • When calling /xrun from an event, expect error such as the event being called twice. One way around this is creating an alias that contains your commands and calling it from the event via /timer 1 0 <alias>