Ok, I imagine this bug is because my scripts aren't ending properly, but basically here is what is happening:
When i start my bot I can usually DCC to it just fine, and do rehash's etc to adjust scripts. Now I notice if I leave my bot up overnight, and try to DCC it again, it does this:
Waiting for acknowledgement...
DCC Chat connection established
<BotName> Enter your password.
So I enter my password, and nothing, it just sits there, the only way for it to actually work again is I have to restart my bot. Is there a way I can check for errors in my scripts, or ways to check the scripts that haven't exitted properly? Help would be appreciated (I hope I put this in the right forum)
Do you have any scripts triggered by a "bind chon"? If not, I bet it's due to unclosed file channels. Are your scripts (the ones reading from files) working when this problem occurs? Check '.tcl file channels' when your bot has been running for a while (should return 'stdin stdout stderr' if everything's fine (and you don't have any script MEANT to leave files open, of course))
If you're logging, did you check your log(s) for errors?
proc parseIni {file} {
array set arr {}
set f [open $file]
while {[gets $f l]>-1} {
set l [string trim $l]
if {[string match {\[*\]} $l]} {
set e [string range $l 1 end-1]
} elseif {[info exists e]&&[string match *?=?* $l]} {
regexp {^([^=]+)=(.+)$} $l a a b
lappend arr($e) [string trim $a] [string trim $b]
}
}
close $f
array get arr
}
If this isn't the problem, then I don't know, I got about a billion return's everywhere, and its not fixing it.
I recommend rewriting that last proc you pasted...writing the file and reading it and then deleting it from within the same proc makes no sense. and since you delete it before you close it, it's not even deleted
Add this to your interpreter to find out who's forgetting to close files:
if {![string len [info procs open]]} {
rename open _open
rename close _close
proc open {args} {
if {[info level]>1} {set by [info level -1]} {set by "global"}
set f [_open openlog.txt a+]
puts $f "open [join $args] ($by)"
_close $f
uplevel 1 [concat _open $args]
}
proc close {args} {
if {[info level]>1} {set by [info level -1]} {set by "global"}
set f [_open openlog.txt a+]
puts $f "close [join $args] ($by)"
_close $f
uplevel 1 [concat _close $args]
}
}
It will create a file called 'openlog.txt' with a line for each open and close done. This should make it fairly easy to find out where you've screwed up. Just let the script run for a while and check the file for opens missing closes.
Last edited by user on Wed Sep 03, 2003 8:33 pm, edited 1 time in total.