cancel
Showing results for 
Search instead for 
Did you mean: 

A simple way to unset all variable during Client_CLOSED ?

danielc
Cirrus
Cirrus

Hello,

I have a CLOSED_CONNECTION irule at the end of the VS to unset all variables:

 
when CLIENT_CLOSED {
  TCP::close
  
  if { [info exists demo1] } {
    unset demo1
  }
  if { [info exists demo2] } {
    unset demo2
  }
 
,,,,,
 
 }
However If I have 1000 variable sauy demo1 to demo1000, then I will need to if 1000 times here to unset them, Is there any simple way can unset all variables during CLIENT_CLOSED ? Thanks
1 ACCEPTED SOLUTION

Variables are scoped to the connection. After its closed they no longer exist. The only time this is not the case when you create global variables via rule_init. So there is no need to delete these.

View solution in original post

4 REPLIES 4

James958
Nimbostratus
Nimbostratus

Variables are scoped to the connection. After its closed they no longer exist. The only time this is not the case when you create global variables via rule_init. So there is no need to delete these.

Hello Kevin,

Thanks for the answer. Just want to confirm , what you said also apply to " TCP::close " , right?

TCP::close is triggered at the close of the connection. Right after the processing of any iRule events related to that connection, the variables should no longer exist. A connection is a TCP session defined by quatuple of source-ip:source-port and destination-ip:destination-port.