Forum Discussion

danielc's avatar
danielc
Icon for Cirrus rankCirrus
Jul 07, 2022

Immediate go to Client_CLOSED during the middle of irule

Hello,

I have multiple irule running in order within VS 1.irule ... 2.irule ... close_connection.irul

My problem is , if I want to , say, when in 2.irule or any irule....

If  {some condition = true} {

....

TCP::CLOSE

}

 

And I have close_connection.irul at the end to unset variables

when CLIENT_CLOSED {
 
 if { [info exists sni_n] } {
    unset sni_n
  }
......
}

Will this achieve what I want?

When I have TCP::CLOSE. will BIGIP still run/process 

when CLIENT_CLOSED {
}
 
?
Thanks..
 
  • No because you dont need to close connections. Whats the main objective here? Why are you trying to unset variables? If its important to unset variables for your application then use a prefix for ones you need to unset.

    An application with seven vars needs to unset four of them. These vars use an underscore prefix so they are _var1 _var2 _var3 _var4 _var5 so the following one line command can be used to unset them. 

    unset [info vars _*]

    If they are not always defined add -nocomplain to the unset command to prevent it logging errors.
    Info is a very useful command - Tcl - info (n) (princeton.edu)

    • danielc's avatar
      danielc
      Icon for Cirrus rankCirrus

      Hello Kevin,

      -> No because you dont need to close connections. Whats the main objective here? 

      I am using these in the irule when detecting HTTP 404, 503 and 504

       
         TCP::close
          event disable all

      I now understand that "  event disable all" is what I need, because, when I have those HTTP status responds, I don't want the rest of the irule to be process, also, because I already use "HTTP::respond"  to respond the "error message".

      The only problem left here is should I really use the TCP::close when I have  "event disable all" after, I guess it is need so that It can release the memory afterward.

      Thanks for your explaination.