From: lvasiliev <lvasiliev@tarantool.org>
To: Alexander Turenko <alexander.turenko@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] socket: fix error while closing socket.tcp_server
Date: Thu, 7 May 2020 10:29:02 +0300 [thread overview]
Message-ID: <8c0c398a-f043-0637-48f6-0d350b7a8c03@tarantool.org> (raw)
In-Reply-To: <20200506153804.5szcwvvl22eeeilr@tkn_work_nb>
Hi! Thank you for the review.
On 06.05.2020 18:38, Alexander Turenko wrote:
>> @@ -1082,6 +1085,9 @@ local function tcp_server_loop(server, s, addr)
>> fiber.name(format("%s/%s:%s", server.name, addr.host, addr.port), {truncate = true})
>> log.info("started")
>> while socket_readable(s) do
>> + if s._server_socket_closed then
>> + break
>> + end
>
> Can we use the same check `<s>._gc_socket.fd >= 0` as in check_socket()
> (we can wrap it to a function like socket_is_closed())?
>
> It seems that using the same way for determining whether a socket is
> closed owuld simplify the code a bit.
>
> WBR, Alexander Turenko.
>
If I understand correctly, in this case we must not only check whether
the socket is closed or not, but also check whether it was closed
without errors by checking errno. In fact, we come to my first patchset,
where I disable throwing an exception from the check_socket(). Disabling
throwing an exception is the right way because now our API doesn't
correspond to the documentation (I will create a ticket for this). But
fixing a socket check leads to big changes in the code that are not
related to the problem and will not pass the review. I can wrap the flag
check in a method, but then all sockets should have a flag and it's look
like overkill (this will duplicate the functionality of the
check_socket() function after fix).
In addition, we don't check EV_ERROR and it seems to me that this can
also lead to the fact that the check you proposed may be insufficient.
next prev parent reply other threads:[~2020-05-07 7:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-24 12:26 Leonid Vasiliev
2020-04-24 14:03 ` lvasiliev
2020-04-29 12:12 ` Ilya Kosarev
2020-05-06 8:01 ` lvasiliev
2020-05-06 8:20 ` Ilya Kosarev
2020-05-06 15:38 ` Alexander Turenko
2020-05-07 7:29 ` lvasiliev [this message]
2020-05-13 14:21 ` Alexander Turenko
2020-05-19 19:52 ` lvasiliev
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=8c0c398a-f043-0637-48f6-0d350b7a8c03@tarantool.org \
--to=lvasiliev@tarantool.org \
--cc=alexander.turenko@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH] socket: fix error while closing socket.tcp_server' \
/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