Forum Discussion

danA's avatar
danA
Icon for Altostratus rankAltostratus
Jun 03, 2022

HSSR maxtime

Hi -

I'm writing an iRule using the HSSR HTTP client and am specifying the -maxtime argument. It looks like there are a couple of issues in how maxclock is computed.

The 'maxtime' argument is specified in seconds as is 'wait', but 'timeout' is in millis, which in most cases should put 'maxclock' somewhere in the past. Also, if the maxtime is not larger than 'timeout' + 'wait', it can also be in the past.

 

if {$maxtime} {
set maxclock [expr {[clock seconds] + $maxtime - ($timeout + $wait)}]
}

Does anyone else use -maxtime? Am I off?

For myself, I've changed the code above to correct for these issue:

set timeout_sec [expr {$timeout / 1000}]
if {$maxtime} {
set now [clock seconds]
set maxclock [expr {[clock seconds] + $maxtime - ($timeout_sec + $wait)}]
if {$maxclock <= [expr $now + $maxtime]} {
set maxclock [expr $now + $maxtime]
}
}

Dan

1 Reply

No RepliesBe the first to reply