From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 559B46EC58; Thu, 5 Aug 2021 11:37:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 559B46EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628152668; bh=i2RUvSAXZxOdi6ZjyeeFpFNuNsqQ5Ic8HweY5iYOXpk=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=LCJ9MBstubDDTrW2r6gAqvRM7e/BoACT7wvXA3EbrnMw29Nxmm+CBz8v4LkgUsg35 fWQ3YvfwbWReF/ZgLsp7qsSVJTghyPLhHvL8269C/Bf90/aNhcYoGB3pnvJl/cmFv+ +bI+wTFDl9ZZR9wsHsc0GFJ6TAhxvSDhky0tpqFY= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5E7B76EC58 for ; Thu, 5 Aug 2021 11:37:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5E7B76EC58 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mBYsr-00019Q-Gr; Thu, 05 Aug 2021 11:37:45 +0300 Date: Thu, 5 Aug 2021 11:37:44 +0300 To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org Message-ID: <20210805083744.5jmemldur3idmlqp@esperanza> References: <5bc68e715031c04ebb022c70cf4ff27c0939598c.1627024646.git.vdavydov@tarantool.org> <9dbecb42-b2c8-ff46-ef1c-c8c14f19357f@tarantool.org> <20210803154416.3zx5t4jkdyh7adhy@esperanza> <6d4d06a2-c1ea-bb3a-2b97-537d538b75e3@tarantool.org> <20210804135658.zcobwyz3rjcbwunu@esperanza> <1ac8acd1-f729-252d-65ff-d9041bea1694@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1ac8acd1-f729-252d-65ff-d9041bea1694@tarantool.org> X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C351B198F4576AC7B20CA14D9DFB46B94A182A05F538085040AECE62F3DB4617030B0E3B3C0E1B58A00426384DE4F34ABD9C6715247054DBAA X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE741DC22BF90A736D8EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D7F1BE85E7B0CA818638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D82B705E7D90213305371F231D8E8D1E99117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8BAA867293B0326636D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B65D56369A3576CBA5089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A501F76ED671AE56531FE6789C661139208823B2F8C2828415D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7501A9DF589746230F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D340CB2836B82369449308C26EB4DD2A23FD42391044A5E76147412E3B59B748430B341D6CEC99165271D7E09C32AA3244C39692695B08B2D44E822FDCAF025C9E93A76366E8A9DE7CAFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojh4v93/7HD3WwJrIi8dOEqQ== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D2AAAC6F3B1BCAB4DE28AF50118A38379274CEFED1673C562683ABF942079399BFB559BB5D741EB966A65DFF43FF7BE03240331F90058701C67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 13/20] net.box: rewrite send_and_recv_{iproto, console} in C X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladimir Davydov via Tarantool-patches Reply-To: Vladimir Davydov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Wed, Aug 04, 2021 at 11:18:55PM +0200, Vladislav Shpilevoy wrote: > > +static int > > +netbox_send_and_recv_iproto(lua_State *L) > > +{ > > + int fd = lua_tointeger(L, 1); > > + struct ibuf *send_buf = (struct ibuf *)lua_topointer(L, 2); > > + struct ibuf *recv_buf = (struct ibuf *)lua_topointer(L, 3); > > + double timeout = (!lua_isnoneornil(L, 4) ? > > + lua_tonumber(L, 4) : TIMEOUT_INFINITY); > > Timeout is never passed to this function. It is always TIMEOUT_INFINITY. > The same for netbox_send_and_recv_console. Removed the unused timeout argument in a separate patch and rebased the rest of the series on top: >From 6cceb3ecc0f326c212103e6319226d40b2223d31 Mon Sep 17 00:00:00 2001 From: Vladimir Davydov Date: Thu, 5 Aug 2021 10:52:13 +0300 Subject: [PATCH] net.box: remove unused timeout argument from IO methods Part of #6241 diff --git a/src/box/lua/net_box.c b/src/box/lua/net_box.c index 19289e750c98..ee3cfe95a49c 100644 --- a/src/box/lua/net_box.c +++ b/src/box/lua/net_box.c @@ -436,7 +436,7 @@ netbox_decode_greeting(lua_State *L) } /** - * communicate(fd, send_buf, recv_buf, limit_or_boundary, timeout) + * communicate(fd, send_buf, recv_buf, limit_or_boundary) * -> errno, error * -> nil, limit/boundary_pos * @@ -467,15 +467,6 @@ netbox_communicate(lua_State *L) else limit = lua_tonumber(L, 4); - /* timeout */ - ev_tstamp timeout = TIMEOUT_INFINITY; - if (lua_type(L, 5) == LUA_TNUMBER) - timeout = lua_tonumber(L, 5); - if (timeout < 0) { - lua_pushinteger(L, ER_TIMEOUT); - lua_pushstring(L, "Timeout exceeded"); - return 2; - } int revents = COIO_READ; while (true) { /* reader serviced first */ @@ -526,18 +517,10 @@ check_limit: goto handle_error; } - ev_tstamp deadline = ev_monotonic_now(loop()) + timeout; ERROR_INJECT_YIELD(ERRINJ_NETBOX_IO_DELAY); revents = coio_wait(fd, EV_READ | (ibuf_used(send_buf) != 0 ? - EV_WRITE : 0), timeout); + EV_WRITE : 0), TIMEOUT_INFINITY); luaL_testcancel(L); - timeout = deadline - ev_monotonic_now(loop()); - timeout = MAX(0.0, timeout); - if (revents == 0 && timeout == 0.0) { - lua_pushinteger(L, ER_TIMEOUT); - lua_pushstring(L, "Timeout exceeded"); - return 2; - } } handle_error: lua_pushinteger(L, ER_NO_CONNECTION); diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua index 242b1c8d9314..3b2d60b39a0d 100644 --- a/src/box/lua/net_box.lua +++ b/src/box/lua/net_box.lua @@ -581,12 +581,12 @@ local function create_transport(host, port, user, password, callback, end -- IO (WORKER FIBER) -- - local function send_and_recv(limit_or_boundary, timeout) + local function send_and_recv(limit_or_boundary) return communicate(connection:fd(), send_buf, recv_buf, - limit_or_boundary, timeout) + limit_or_boundary) end - local function send_and_recv_iproto(timeout) + local function send_and_recv_iproto() local data_len = recv_buf.wpos - recv_buf.rpos local required if data_len < 5 then @@ -603,17 +603,16 @@ local function create_transport(host, port, user, password, callback, return nil, hdr, body_rpos, body_end end end - local deadline = fiber_clock() + (timeout or TIMEOUT_INFINITY) - local err, extra = send_and_recv(required, timeout) + local err, extra = send_and_recv(required) if err then return err, extra end - return send_and_recv_iproto(max(0, deadline - fiber_clock())) + return send_and_recv_iproto() end - local function send_and_recv_console(timeout) + local function send_and_recv_console() local delim = '\n...\n' - local err, delim_pos = send_and_recv(delim, timeout) + local err, delim_pos = send_and_recv(delim) if err then return err, delim_pos else