TCP:after_timer_get()
Allows the user to get the information about the scheduled timers.
When successful, returns a string for one timer, a table of strings for multiple timers. For example, the returned string “'AFTER_TIMER_NAME':5000:periodic” shows the timer name, expiration in milliseconds and if it is periodic.
Returns nil for all failures.
Syntax
TCP:after_timer_get ([timer_cb_name]);
Arguments
| Name | Description |
|---|---|
|
timer_cb_name |
A string to indicate the name of the timer. This parameter is optional. If this parameter is empty, then the function will get the information for all existing timers. |
Events
Applicable in the following events:
-
HTTP events: HTTP_REQUEST, HTTP_RESPONSE, HTTP_DATA_REQUEST, HTTP_DATA_RESPONSE
-
TCP events: TCP_ACCEPTED, SERVER_CONNECTED, SERVER_BEFORE_CONNECT
Example
when TCP_ACCEPTED {
AFTER_TIMER_NAME = function ()
debug("[%s]====>After function call begin:\n",ctime());
debug("[%s]====>After function call end.\n",ctime());
end
TCP:after_timer_set("AFTER_TIMER_NAME", 1000, true);
ret = TCP:after_timer_get("AFTER_TIMER_NAME");
debug("after_timer_get success: %s\n", ret);
}
When the client successfully creates a TCP connection, the script will be executed. This function gets the after_timer information and prints it out on the first line.
FortiADC console debug output:
after_timer_get success: 'AFTER_TIMER_NAME':1000:periodic [Thu Oct 5 12:36:34 2023]====>After function call begin: [Thu Oct 5 12:36:34 2023]====>After function call end. [Thu Oct 5 12:36:35 2023]====>After function call begin: [Thu Oct 5 12:36:35 2023]====>After function call end.
Supported Version
FortiADC version 7.4.1 and later.