Fortinet white logo
Fortinet white logo

Script Reference Guide

TCP:after_timer_cancel(timer_cb_name)

TCP:after_timer_cancel(timer_cb_name)

Allows the user to cancel a scheduled timer. This function can only cancel a timer before it is triggered if it is not periodic.

Returns Boolean true if successful, otherwise, returns Boolean false.

Syntax

TCP:after_timer_cancel (timer_cb_name);

Arguments

Name Description

timer_cb_name

A string to indicate the name of the timer to be canceled. This parameter is required.

Events

Applicable in the following events:

  • HTTP_DATA_REQUEST

  • HTTP_DATA_RESPONSE

  • HTTP_REQUEST

  • HTTP_RESPONSE

  • SERVER_BEFORE_CONNECT

  • SERVER_CONNECTED

  • TCP_ACCEPTED

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);
}
when HTTP_REQUEST {
    debug("[%s]------> Events: HTTP_REQUEST begin:\n", ctime());
    TCP:after_timer_cancel("AFTER_TIMER_NAME");
}

When the client successfully creates a TCP connection, the script will be executed. When the HTTP is requested, the AFTER_TIMER_NAME will be stopped.

FortiADC console debug output:

[Thu Oct  5 13:37:51 2023]====>After function call begin:
[Thu Oct  5 13:37:51 2023]====>After function call end.
[Thu Oct  5 13:37:52 2023]====>After function call begin:
[Thu Oct  5 13:37:52 2023]====>After function call end.
[Thu Oct  5 13:37:53 2023]------> Events: HTTP_REQUEST begin:

Supported Version

FortiADC version 7.4.1 and later.

TCP:after_timer_cancel(timer_cb_name)

TCP:after_timer_cancel(timer_cb_name)

Allows the user to cancel a scheduled timer. This function can only cancel a timer before it is triggered if it is not periodic.

Returns Boolean true if successful, otherwise, returns Boolean false.

Syntax

TCP:after_timer_cancel (timer_cb_name);

Arguments

Name Description

timer_cb_name

A string to indicate the name of the timer to be canceled. This parameter is required.

Events

Applicable in the following events:

  • HTTP_DATA_REQUEST

  • HTTP_DATA_RESPONSE

  • HTTP_REQUEST

  • HTTP_RESPONSE

  • SERVER_BEFORE_CONNECT

  • SERVER_CONNECTED

  • TCP_ACCEPTED

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);
}
when HTTP_REQUEST {
    debug("[%s]------> Events: HTTP_REQUEST begin:\n", ctime());
    TCP:after_timer_cancel("AFTER_TIMER_NAME");
}

When the client successfully creates a TCP connection, the script will be executed. When the HTTP is requested, the AFTER_TIMER_NAME will be stopped.

FortiADC console debug output:

[Thu Oct  5 13:37:51 2023]====>After function call begin:
[Thu Oct  5 13:37:51 2023]====>After function call end.
[Thu Oct  5 13:37:52 2023]====>After function call begin:
[Thu Oct  5 13:37:52 2023]====>After function call end.
[Thu Oct  5 13:37:53 2023]------> Events: HTTP_REQUEST begin:

Supported Version

FortiADC version 7.4.1 and later.