Merge pull request #18704 from Pdoijode/pdoijode/zapi-cancel-new-accept
Some checks are pending
build-test / Build the x86 ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu x86 docker image (push) Blocked by required conditions
build-test / Build the ARM ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu ARM docker image (push) Blocked by required conditions

zebra: Cancel new client accept events after zsock is closed
This commit is contained in:
Russ White 2025-04-28 07:43:33 -04:00 committed by GitHub
commit fc21c74db5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -895,19 +895,20 @@ void zserv_release_client(struct zserv *client)
*/ */
static void zserv_accept(struct event *thread) static void zserv_accept(struct event *thread)
{ {
int accept_sock;
int client_sock; int client_sock;
struct sockaddr_in client; struct sockaddr_in client;
socklen_t len; socklen_t len;
accept_sock = EVENT_FD(thread); if (zsock < 0) {
/* Return if this event pops after zsock is closed. */
return;
}
/* Reregister myself. */ /* Reregister myself. */
zserv_event(NULL, ZSERV_ACCEPT); zserv_event(NULL, ZSERV_ACCEPT);
len = sizeof(struct sockaddr_in); len = sizeof(struct sockaddr_in);
client_sock = accept(accept_sock, (struct sockaddr *)&client, &len); client_sock = accept(zsock, (struct sockaddr *)&client, &len);
if (client_sock < 0) { if (client_sock < 0) {
flog_err_sys(EC_LIB_SOCKET, "Can't accept zebra socket: %s", flog_err_sys(EC_LIB_SOCKET, "Can't accept zebra socket: %s",
safe_strerror(errno)); safe_strerror(errno));