Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Alexander Turenko <alexander.turenko@tarantool.org>
Cc: tarantool-patches@freelists.org,
	Yaroslav Dynnikov <yaroslav.dynnikov@tarantool.org>
Subject: Re: [PATCH 1/3] socket: evaluate buffer size in recv / recvfrom
Date: Mon, 27 Aug 2018 12:20:59 +0300	[thread overview]
Message-ID: <20180827092059.fa2mzesvn4jcvqnu@esperanza> (raw)
In-Reply-To: <20180827000848.cmtlbxrrbub5svn6@tkn_work_nb>

On Mon, Aug 27, 2018 at 03:08:49AM +0300, Alexander Turenko wrote:
> On Fri, Aug 24, 2018 at 06:25:42PM +0300, Vladimir Davydov wrote:
> > On Fri, Aug 24, 2018 at 05:47:37AM +0300, Alexander Turenko wrote:
> > > diff --git a/src/lua/socket.lua b/src/lua/socket.lua
> > > index 06306eae2..946e11e9e 100644
> > > --- a/src/lua/socket.lua
> > > +++ b/src/lua/socket.lua
> > > @@ -770,6 +770,41 @@ local function socket_send(self, octets, flags)
> > >      return tonumber(res)
> > >  end
> > >  
> > > +local function socket_is_udp(self)
> > > +    local fd = check_socket(self)
> > > +    if self.itype == nil then
> > > +        self.itype = self:getsockopt('SOL_SOCKET', 'SO_TYPE')
> > 
> > I think you could instead set itype in socket constructor.
> > 
> 
> That will increase memory consumption in case when it is not needed to
> know itype: say, for sending sockets (I should add comment about this,
> of course). However I think it is worth to cache it when revc / recvfrom
> is used intensively to avoid extra syscall.
> 
> Do you think we can ignore extra memory comsumption in this case?

How much of memory overhead is it going to be? Several bytes per socket?
IMHO we can ignore it.

  reply	other threads:[~2018-08-27  9:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24  2:47 [PATCH 0/3] *** [#3619] socket.recvfrom crops UDP packets *** Alexander Turenko
2018-08-24  2:47 ` [PATCH 1/3] socket: evaluate buffer size in recv / recvfrom Alexander Turenko
2018-08-24 14:07   ` Vladimir Davydov
2018-08-24 15:25   ` Vladimir Davydov
2018-08-27  0:08     ` Alexander Turenko
2018-08-27  9:20       ` Vladimir Davydov [this message]
2018-08-27  9:26         ` Alexander Turenko
2018-08-24  2:47 ` [PATCH 2/3] socket: don't truncate a datagram in recv/recvfrom Alexander Turenko
2018-08-24 15:24   ` Vladimir Davydov
2018-08-24  2:47 ` [PATCH 3/3] socket: prevent recvfrom from returning garbage Alexander Turenko
2018-08-24 13:07   ` Vladimir Davydov
2018-08-24 13:44     ` Alexander Turenko
2018-08-24 13:55       ` Vladimir Davydov
2018-08-24 17:11   ` Vladimir Davydov

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=20180827092059.fa2mzesvn4jcvqnu@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=yaroslav.dynnikov@tarantool.org \
    --subject='Re: [PATCH 1/3] socket: evaluate buffer size in recv / recvfrom' \
    /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