* Event exit API changed to a single decrementing counter where 1 means exit.

* Removed: `clicon_exit_reset()`
  * Changed: `clicon_exit_set()` --> `clixon_exit_set(int nr)`
  * Changed: `clicon_exit_get()` --> `clixon_exit_get()`
* native restconf special case upgrade handling from http/1 -> http/2 and restconf restart: delay the restart using event exit counter
This commit is contained in:
Olof hagsand 2021-06-16 11:58:13 +02:00
parent 4f513385e9
commit b40dafb691
10 changed files with 63 additions and 36 deletions

View file

@ -190,7 +190,7 @@ restconf_stream_cb(int s,
FCGX_FPrintF(r->out, "SHUTDOWN\r\n");
FCGX_FPrintF(r->out, "\r\n");
FCGX_FFlush(r->out);
clicon_exit_set();
clixon_exit_set(1);
goto done;
}
if ((ret = clicon_msg_decode(reply, NULL, NULL, &xtop, NULL)) < 0) /* XXX pass yang_spec */
@ -335,7 +335,7 @@ stream_checkuplink(int s,
clicon_debug(1, "%s", __FUNCTION__);
if (FCGX_GetError(r->out) != 0){ /* break loop */
clicon_debug(1, "%s FCGX_GetError upstream", __FUNCTION__);
clicon_exit_set();
clixon_exit_set(1);
}
return 0;
}
@ -351,7 +351,7 @@ stream_timeout(int s,
clicon_debug(1, "%s", __FUNCTION__);
if (FCGX_GetError(r->out) != 0){ /* break loop */
clicon_debug(1, "%s FCGX_GetError upstream", __FUNCTION__);
clicon_exit_set();
clixon_exit_set(1);
}
else{
gettimeofday(&t, NULL);
@ -485,7 +485,7 @@ api_stream(clicon_handle h,
clixon_event_unreg_fd(rfcgi->listen_sock,
restconf_stream_cb);
clixon_event_unreg_timeout(stream_timeout, (void*)req);
clicon_exit_reset();
clixon_exit_set(0); /* reset */
#ifdef STREAM_FORK
FCGX_Finish_r(rfcgi);
FCGX_Free(rfcgi, 0);