Forum Discussion

scott_sams_8256's avatar
scott_sams_8256
Icon for Nimbostratus rankNimbostratus
Mar 19, 2009

if else logic

i guess this isnt right.

 

can i get some help on my else if logic. have three conditions, three pools to check based on info in packet. thanks!

 

when CLIENT_ACCEPTED {

 

TCP::collect 15

 

}

 

when CLIENT_DATA {

 

if { [TCP::payload 15] contains "1" } {

 

pool 1

 

} elseif { [TCP::payload 15] contains "2" } {

 

pool 2

 

} else {

 

pool 3

 

TCP::release

 

}

4 Replies

  • did i just miss the last bracket before TCP::release?

     

    }

     

    when CLIENT_ACCEPTED {

     

    TCP::collect 15

     

    }

     

    when CLIENT_DATA {

     

    if { [TCP::payload 15] contains "1" } {

     

    pool 1

     

    } elseif { [TCP::payload 15] contains "2" } {

     

    pool 2

     

    } else {

     

    pool 3

     

    }

     

    TCP::release

     

    }
  • The last one looks ok, and I was able to save it using iRule Editor.

     

  • Yeah, I think you would want to call TCP::release after the pool selection regardless of which condition is true, so the last version looks correct.

     

     

    Aaron