Forum Discussion
Rusty_Hale_8009
Jan 26, 2007Nimbostratus
Joe, Again, I am no programmer but I am getting this error:
Jan 26 13:45:52 tmm tmm[1227]: 01220001:3: TCL error: Rule Connection_Limit_Log - can't read "::active_clients(83.67.17.107)": no such element in array while executing "set total_cons $::active_clients($client_ip)"
When our irule looks like this:
when RULE_INIT {
array set ::active_clients { }
}
when CLIENT_ACCEPTED {
set client_ip [IP::remote_addr]
set conn_threshold 10
set total_cons $::active_clients($client_ip)
if { [info exists ::active_clients($client_ip)] } {
if {$::active_clients($client_ip) > $conn_threshold } {
log local0.info "$client_ip $total_cons using VS [IP::local_addr]"
return
} else {
incr ::active_clients($client_ip)
}
} else {
set ::active_clients($client_ip) 1
}
}
when CLIENT_CLOSED {
if { [info exists ::active_clients($client_ip)] } {
incr ::active_clients($client_ip) -1
if { $::active_clients($client_ip) <= 0 } {
unset ::active_clients($client_ip)
}
}
}
So where did we screw up?