Options

aFleX to drop persistent connections

Posted by TODDH

I needed to drop persistent connections immediately when a health check fails.

I used the below aFleX to check the status of the node and if it is anything other than "up" the connection is reset.

Thanks,

-Todd-



when CLIENT_ACCEPTED {
}

when CLIENT_DATA {
if {$s_ip equals "10.12.12.230"} {
# Check if server is still up
if {[LB::status pool Pool-Name member 10.12.12.230 $s_port] == "up"} {
# If server UP simply forward the packet
TCP::release
TCP::collect
} else {
# if server is down reset the connection
log "drop connection $s_ip"
reject
}
}
# For my Server2 (10.12.12.231)
if {$s_ip equals "10.12.12.231"} {
# Check if server is still up
if {[LB::status pool Pool-Name member 10.12.12.231 $s_port] == "up"} {
# If server UP simply forward the packet
TCP::release
TCP::collect
} else {
# if server is down reset the connection
log "drop connection $s_ip"
reject
}
}
}

when SERVER_CONNECTED {
set s_ip [IP::server_addr]
set s_port [TCP::server_port]
clientside {TCP::collect}
}
Sign In or Register to comment.