From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id D579C2BEC9 for ; Wed, 24 Apr 2019 12:40:42 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uVV5yNn6OB3p for ; Wed, 24 Apr 2019 12:40:42 -0400 (EDT) Received: from smtp1.mail.ru (smtp1.mail.ru [94.100.179.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 7DB7D2BEC5 for ; Wed, 24 Apr 2019 12:40:42 -0400 (EDT) Date: Wed, 24 Apr 2019 19:40:39 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH 4/6] swim: wrap sio_strfaddr() Message-ID: <20190424164039.GD13687@atlas> References: <73ba32c413ce9371b845ac161a0d5ea698fac575.1556116199.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <73ba32c413ce9371b845ac161a0d5ea698fac575.1556116199.git.v.shpilevoy@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Vladislav Shpilevoy Cc: tarantool-patches@freelists.org * Vladislav Shpilevoy [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. > 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