mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
librb: close FDs when they're freed (outside of select handler)
This commit is contained in:
parent
fed4fc59bc
commit
ff0414c856
2 changed files with 10 additions and 15 deletions
|
@ -110,6 +110,16 @@ free_fds(void)
|
|||
RB_DLINK_FOREACH_SAFE(ptr, next, closed_list.head)
|
||||
{
|
||||
F = ptr->data;
|
||||
|
||||
number_fd--;
|
||||
|
||||
#ifdef _WIN32
|
||||
if(F->type & (RB_FD_SOCKET | RB_FD_PIPE))
|
||||
closesocket(F->fd);
|
||||
else
|
||||
#endif
|
||||
close(F->fd);
|
||||
|
||||
rb_dlinkDelete(ptr, &closed_list);
|
||||
rb_bh_free(fd_heap, F);
|
||||
}
|
||||
|
@ -885,18 +895,6 @@ rb_close(rb_fde_t *F)
|
|||
remove_fd(F);
|
||||
ClearFDOpen(F);
|
||||
}
|
||||
|
||||
number_fd--;
|
||||
|
||||
#ifdef _WIN32
|
||||
if(type & (RB_FD_SOCKET | RB_FD_PIPE))
|
||||
{
|
||||
closesocket(fd);
|
||||
return;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -188,9 +188,6 @@ rb_select_epoll(long delay)
|
|||
PF *hdl;
|
||||
rb_fde_t *F = ep_info->pfd[i].data.ptr;
|
||||
old_flags = F->pflags;
|
||||
|
||||
if(!IsFDOpen(F))
|
||||
continue;
|
||||
if(ep_info->pfd[i].events & (EPOLLIN | EPOLLHUP | EPOLLERR))
|
||||
{
|
||||
hdl = F->read_handler;
|
||||
|
|
Loading…
Reference in a new issue