From e208e44eef620f1f00fa150b992f3737192a637a Mon Sep 17 00:00:00 2001 From: Dmitry Simonenko Date: Fri, 18 Nov 2016 16:27:59 +0300 Subject: [PATCH] flint: pre-check cancel state for ft_accept() --- lib/ft_ioaccept.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ft_ioaccept.c b/lib/ft_ioaccept.c index fb8c0cfc..8b73ac69 100644 --- a/lib/ft_ioaccept.c +++ b/lib/ft_ioaccept.c @@ -41,10 +41,13 @@ FLINT_API int ft_accept(ftio_t iop, ftio_t *client) { ftio *io = iop; + ftfiber *current = ft_current(io->f); + if (ft_fiber_is_cancel(current)) + return -ECANCELED; if (io->accept_fiber) return -1; io->accept_status = 0; - io->accept_fiber = ft_current(io->f); + io->accept_fiber = current; int rc; rc = uv_listen((uv_stream_t*)&io->handle, 128, ft_io_accept_cb); if (rc < 0) {