Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org,
	Konstantin Osipov <kostja@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 4/6] swim: wrap sio_strfaddr()
Date: Wed, 24 Apr 2019 23:23:16 +0300	[thread overview]
Message-ID: <68d992e3-e92f-680c-73a3-eb2e5ad1f6b3@tarantool.org> (raw)
In-Reply-To: <20190424164039.GD13687@atlas>



On 24/04/2019 19:40, Konstantin Osipov wrote:
> * Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [19/04/24 18:50]:
>> SIO provides a function sio_strfaddr() to obtain string
>> representation of arbitrary struct sockaddr. And it uses
>> singleton buffer to store results, because some of them can't
>> fit into tt_static_buf() according to POSIX name limits.
> 
> This is minor, but I would make sio_strfaddr() use the same set of
> buffers as provided by tt_static_buf() instead, with a static
> assert that the buffer size is large enough.

As I said, the tt_static_buf is not big enough. SIO uses NI_MAXHOST
constant which on Linux is 1025 > size of tt_static_buf.

http://man7.org/linux/man-pages/man3/getnameinfo.3.html

If you still think we will not break anything, I can do that. Just
confirm that you are sure.

It will not eliminate swim_inaddr_str() though, because most of
the problems were about huge cast to 'const struct sockaddr *'
and passing sizeof(struct sockaddr_in) each time - it made code
unreadable.

> 
>> SWIM uses only AF_INET addresses, they are short enough to fit
>> into tt_static_buf(). Also SWIM is going to call sio_strfaddr()
>> on more than 1 address in a row in subsequent patches, and
>> singleton buffer does not work here - each call will overwrite
>> result of the previous. Besides, SWIM never uses struct sockaddr
>> type. All these reasons are sufficient to wrap sio_strfaddr()
>> with encapsulated cast to struct sockaddr *, and copying on
>> tt_static_buf().
>>
> 
> -- 
> Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
> http://tarantool.io - www.twitter.com/kostja_osipov
> 

  reply	other threads:[~2019-04-24 20:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 14:36 [tarantool-patches] [PATCH 0/6] swim suspicion Vladislav Shpilevoy
2019-04-24 14:36 ` [tarantool-patches] [PATCH 1/6] test: rename swim_cluster_node to swim_cluster_member Vladislav Shpilevoy
2019-04-24 16:37   ` [tarantool-patches] " Konstantin Osipov
2019-04-24 14:36 ` [tarantool-patches] [PATCH 2/6] test: remove swim packet filter destructors Vladislav Shpilevoy
2019-04-24 16:37   ` [tarantool-patches] " Konstantin Osipov
2019-04-24 14:36 ` [tarantool-patches] [PATCH 3/6] test: introduce swim packet filter by destination address Vladislav Shpilevoy
2019-04-24 16:38   ` [tarantool-patches] " Konstantin Osipov
2019-04-24 14:36 ` [tarantool-patches] [PATCH 4/6] swim: wrap sio_strfaddr() Vladislav Shpilevoy
2019-04-24 16:40   ` [tarantool-patches] " Konstantin Osipov
2019-04-24 20:23     ` Vladislav Shpilevoy [this message]
2019-04-25 10:34       ` Konstantin Osipov
2019-04-25 13:50         ` Vladislav Shpilevoy
2019-04-24 14:36 ` [tarantool-patches] [PATCH 5/6] swim: introduce routing Vladislav Shpilevoy
2019-04-24 16:46   ` [tarantool-patches] " Konstantin Osipov
2019-04-24 20:25     ` Vladislav Shpilevoy
2019-04-25 10:39       ` Konstantin Osipov
2019-04-25 13:50         ` Vladislav Shpilevoy
2019-04-25 13:57           ` Konstantin Osipov
2019-04-24 14:36 ` [tarantool-patches] [PATCH 6/6] swim: introduce suspicion Vladislav Shpilevoy
2019-04-24 17:01   ` [tarantool-patches] " Konstantin Osipov
2019-04-24 20:28     ` Vladislav Shpilevoy
2019-04-25 10:42       ` Konstantin Osipov

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=68d992e3-e92f-680c-73a3-eb2e5ad1f6b3@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH 4/6] swim: wrap sio_strfaddr()' \
    /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