Skip to content

Commit 4b5af95

Browse files
JianyuWang0623jerpelea
authored andcommitted
system/fastboot: remove interest and close epoll
Remove fds from the interest list and close epoll if need. Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
1 parent ee33688 commit 4b5af95

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

system/fastboot/fastboot.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,15 +1008,15 @@ static void fastboot_command_loop(FAR struct fastboot_ctx_s *ctx,
10081008
if (epoll_ctl(epfd, EPOLL_CTL_ADD, c->tran_fd[0], &ev[n]) < 0)
10091009
{
10101010
fb_err("err add poll %d", c->tran_fd[0]);
1011-
return;
1011+
goto epoll_close;
10121012
}
10131013
}
10141014

10151015
if (ctx->left > 0)
10161016
{
10171017
if (epoll_wait(epfd, ev, nitems(ev), ctx->left) <= 0)
10181018
{
1019-
return;
1019+
goto epoll_close;
10201020
}
10211021
}
10221022

@@ -1061,6 +1061,14 @@ static void fastboot_command_loop(FAR struct fastboot_ctx_s *ctx,
10611061
}
10621062
}
10631063
}
1064+
1065+
epoll_close:
1066+
while (--c >= ctx)
1067+
{
1068+
epoll_ctl(epfd, EPOLL_CTL_DEL, c->tran_fd[0], NULL);
1069+
}
1070+
1071+
close(epfd);
10641072
}
10651073

10661074
static void fastboot_publish(FAR struct fastboot_ctx_s *ctx,

0 commit comments

Comments
 (0)