From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH 06/11] evio: make on_accept be nothrow
Date: Mon, 3 Dec 2018 17:58:28 +0300 [thread overview]
Message-ID: <20181203145828.iholwtaejm2arnib@esperanza> (raw)
In-Reply-To: <5aa67f292cac37f8b9d2f77b97221b81b1513195.1543590433.git.v.shpilevoy@tarantool.org>
On Fri, Nov 30, 2018 at 06:39:38PM +0300, Vladislav Shpilevoy wrote:
> diff --git a/src/box/iproto.cc b/src/box/iproto.cc
> index 07ef23cac..dd76e28bd 100644
> --- a/src/box/iproto.cc
> +++ b/src/box/iproto.cc
> @@ -1800,26 +1800,23 @@ iproto_on_accept(struct evio_service * /* service */, int fd,
> struct iproto_msg *msg;
> struct iproto_connection *con = iproto_connection_new(fd);
> if (con == NULL)
> - goto error_conn;
> + return -1;
> /*
> * Ignore msg allocation failure - the queue size is
> * fixed so there is a limited number of msgs in
> * use, all stored in just a few blocks of the memory pool.
> */
> msg = iproto_msg_new(con);
> - if (msg == NULL)
> - goto error_msg;
> + if (msg == NULL) {
> + mempool_free(&iproto_connection_pool, con);
> + return -1;
> + }
> cmsg_init(&msg->base, connect_route);
> msg->p_ibuf = con->p_ibuf;
> msg->wpos = con->wpos;
> msg->close_connection = false;
> cpipe_push(&tx_pipe, &msg->base);
> - return;
> -error_msg:
> - mempool_free(&iproto_connection_pool, con);
> -error_conn:
> - close(fd);
> - return;
> + return 0;
You don't close the file descriptor on error anymore. I guess it's OK,
because evio_service_accept_cb will close it anyway.
> @@ -612,14 +612,12 @@ coio_service_on_accept(struct evio_service *evio_service,
> "%s/%s", evio_service->name, sio_strfaddr(addr, addrlen));
>
> /* Create the worker fiber. */
> - struct fiber *f;
> - try {
> - f = fiber_new_xc(fiber_name, service->handler);
> - } catch (struct error *e) {
> - error_log(e);
> + struct fiber *f = fiber_new(fiber_name, service->handler);
> + if (f == NULL) {
> + diag_log();
> say_error("can't create a handler fiber, dropping client connection");
> evio_close(loop(), &coio);
However, you do close fd here, via evio_close(). Care to remove it?
next prev parent reply other threads:[~2018-12-03 14:58 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-30 15:39 [PATCH 00/11] SWIM preparation Vladislav Shpilevoy
2018-11-30 15:39 ` [PATCH 01/11] box: move info_handler interface into src/info Vladislav Shpilevoy
2018-12-03 11:05 ` Vladimir Davydov
2018-12-03 21:48 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-03 20:41 ` [tarantool-patches] " Konstantin Osipov
2018-12-03 21:48 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-04 8:52 ` Vladimir Davydov
2018-11-30 15:39 ` [PATCH 10/11] evio: remove exceptions Vladislav Shpilevoy
2018-11-30 15:39 ` [PATCH 11/11] evio: turn into C Vladislav Shpilevoy
2018-11-30 15:39 ` [PATCH 02/11] sio: remove unused functions, restyle code Vladislav Shpilevoy
2018-12-03 12:28 ` Vladimir Davydov
2018-12-04 21:29 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-05 8:41 ` Vladimir Davydov
2018-11-30 15:39 ` [PATCH 03/11] sio: remove exceptions Vladislav Shpilevoy
2018-12-03 12:36 ` Vladimir Davydov
2018-12-04 21:29 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-05 8:42 ` Vladimir Davydov
2018-11-30 15:39 ` [PATCH 04/11] sio: fix passing negative size_t to sio_add_to_iov Vladislav Shpilevoy
2018-12-03 13:50 ` Vladimir Davydov
2018-12-04 21:29 ` Vladislav Shpilevoy
2018-12-05 8:48 ` Vladimir Davydov
2018-11-30 15:39 ` [PATCH 05/11] sio: turn into C Vladislav Shpilevoy
2018-11-30 15:39 ` [PATCH 06/11] evio: make on_accept be nothrow Vladislav Shpilevoy
2018-12-03 14:58 ` Vladimir Davydov [this message]
2018-12-04 21:29 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-05 8:52 ` Vladimir Davydov
2018-11-30 15:39 ` [PATCH 07/11] coio: fix file descriptor leak on accept Vladislav Shpilevoy
2018-12-03 16:16 ` Vladimir Davydov
2018-12-04 21:29 ` [tarantool-patches] " Vladislav Shpilevoy
2018-11-30 15:39 ` [PATCH 08/11] coio: fix double close of a file descriptor Vladislav Shpilevoy
2018-12-03 16:19 ` Vladimir Davydov
2018-12-04 21:29 ` [tarantool-patches] " Vladislav Shpilevoy
2018-11-30 15:39 ` [PATCH 09/11] evio: refactoring Vladislav Shpilevoy
2018-12-03 16:37 ` Vladimir Davydov
2018-12-04 21:29 ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-03 9:47 ` [PATCH 00/11] SWIM preparation Vladimir Davydov
2018-12-03 10:27 ` [tarantool-patches] " Vladislav Shpilevoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181203145828.iholwtaejm2arnib@esperanza \
--to=vdavydov.dev@gmail.com \
--cc=tarantool-patches@freelists.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [PATCH 06/11] evio: make on_accept be nothrow' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox