[PATCH 1/3] socket: evaluate buffer size in recv / recvfrom

Vladimir Davydov vdavydov.dev at gmail.com
Fri Aug 24 18:25:42 MSK 2018


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.

> +    end
> +    return self.itype == internal.SO_TYPE['SOCK_DGRAM']
> +end



More information about the Tarantool-patches mailing list