File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1114,7 +1114,6 @@ int cli_loop(struct cli_def *cli, int sockfd) {
11141114
11151115 // Set the last action now so we don't time immediately
11161116 if (cli -> idle_timeout ) time (& cli -> last_action );
1117- if (cli -> regular_callback ) time (& cli -> last_regular );
11181117
11191118 // Start off in unprivileged mode
11201119 cli_set_privilege (cli , PRIVILEGE_UNPRIVILEGED );
@@ -1187,16 +1186,6 @@ int cli_loop(struct cli_def *cli, int sockfd) {
11871186 cli -> showprompt = 0 ;
11881187 }
11891188
1190- if (cli -> regular_callback ) {
1191- if (time (NULL ) - cli -> last_regular >= cli -> timeout_tm .tv_sec ) {
1192- if (cli -> regular_callback (cli ) != CLI_OK ) {
1193- l = -1 ;
1194- break ;
1195- }
1196- time (& cli -> last_regular );
1197- }
1198- }
1199-
12001189 if ((sr = cli_socket_wait (sockfd , & tm )) < 0 ) {
12011190 if (errno == EINTR ) continue ;
12021191 perror (CLI_SOCKET_WAIT_PERROR );
@@ -1205,6 +1194,12 @@ int cli_loop(struct cli_def *cli, int sockfd) {
12051194 }
12061195
12071196 if (sr == 0 ) {
1197+ // Timeout every second
1198+ if (cli -> regular_callback && cli -> regular_callback (cli ) != CLI_OK ) {
1199+ l = -1 ;
1200+ break ;
1201+ }
1202+
12081203 if (cli -> idle_timeout ) {
12091204 if (time (NULL ) - cli -> last_action >= cli -> idle_timeout ) {
12101205 if (cli -> idle_timeout_callback ) {
Original file line number Diff line number Diff line change @@ -78,7 +78,6 @@ struct cli_def {
7878 time_t idle_timeout ;
7979 int (* idle_timeout_callback )(struct cli_def * );
8080 time_t last_action ;
81- time_t last_regular ;
8281 int telnet_protocol ;
8382 void * user_context ;
8483 struct cli_optarg_pair * found_optargs ;
You can’t perform that action at this time.
0 commit comments