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 8D65D6EC40; Wed, 11 Aug 2021 14:30:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8D65D6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628681425; bh=6rk2AzB8oPEok9X+4v3RWOPNjlksppm5olbRIBAT3ow=; 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=hAT3mcGQp+ViApXgRgIGDdjAcYkJlNgzLN7zHtNQLAQo7TC7reRMlzGnC0V2y6YWL NLcg+GwG53XP2k9X/O/SDRp/wUO3m3X6EmK6AwhAokLE6yJt6y/36iA5CTDQkXGI+5 /9xoa2kNQ4kW4PXrsDaf/vYtSYEdFutGckeyqC3U= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (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 5BCC56EC40 for ; Wed, 11 Aug 2021 14:30:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5BCC56EC40 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1mDmRD-0002tI-DW; Wed, 11 Aug 2021 14:30:23 +0300 Date: Wed, 11 Aug 2021 14:30:22 +0300 To: mechanik20051988 Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org, mechanik20051988 Message-ID: <20210811113022.6qm5wfo4sn57x264@esperanza> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9736CF3E71F18CE0C3E1D5927724F4AAA182A05F538085040BD1840D7B41D23AAE7162E4EE68306FBA94A709679FC5CAAD3FC3DC57E292BA6 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73B44982FA5E78411EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637652CD06254D2F21C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8DB24B13069718EAE5F15BBBC79D4F352117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18BDFBBEFFF4125B51D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A53F04745BC0B16A7968761E4C82072F576C4AE9945C162C0DD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA753177526CD55AFC11410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349F4E6BC39AAD02BBE7EECF5E98C78322350D00E98E661F525F7EB0FEB219DE3EC90444159DA2A4681D7E09C32AA3244C78068308956E4B8A6F75C204AB4CC9D7E646F07CC2D4F3D883B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj6qlzQV0oSZPOka0Xqxe+zA== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DC87CA66DAF8553924841E8B119525BF9274CEFED1673C562683ABF942079399BFB559BB5D741EB966A65DFF43FF7BE03240331F90058701C67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v3 5/8] iproto: implement streams in iproto 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 11, 2021 at 11:56:55AM +0300, mechanik20051988 wrote: > diff --git a/src/box/iproto.cc b/src/box/iproto.cc > index dcf60e1be..3b792130b 100644 > --- a/src/box/iproto.cc > +++ b/src/box/iproto.cc > @@ -1873,12 +2049,52 @@ tx_process_replication(struct cmsg *m) > } > } > > +static void > +iproto_msg_finish_processing_in_stream(struct iproto_msg *msg) > +{ > + struct iproto_connection *con = msg->connection; > + struct iproto_stream *stream = msg->stream; > + > + assert(stream != NULL); > + struct iproto_msg *tmp = > + stailq_shift_entry(&stream->pending_requests, > + struct iproto_msg, in_stream); > + assert(tmp == msg); > + (void)tmp; > + errinj_stream_msg_count_add(-1); > + > + if (stailq_empty(&stream->pending_requests)) { > + struct mh_i64ptr_node_t node = { stream->id, NULL }; > + mh_i64ptr_remove(con->streams, &node, 0); > + iproto_stream_delete(stream); > + } else { > + /* > + * If there are new messages for this stream > + * then schedule their processing. > + */ > + struct iproto_msg *next = > + stailq_first_entry(&stream->pending_requests, > + struct iproto_msg, > + in_stream); > + assert(next != NULL); > + next->wpos = con->wpos; > + cpipe_push_input(&con->iproto_thread->tx_pipe, &next->base); > + cpipe_flush_input(&con->iproto_thread->tx_pipe); > + } > +} > + > static void > net_send_msg(struct cmsg *m) > { > struct iproto_msg *msg = (struct iproto_msg *) m; > struct iproto_connection *con = msg->connection; > + struct iproto_stream *stream = msg->stream; > + > + if (stream == NULL) > + goto send_msg; Please fold this check into iproto_msg_finish_processing_in_stream and call the latter unconditionally, like you do in case of iproto_msg_start_processing_in_stream. After this LGTM. > > + iproto_msg_finish_processing_in_stream(msg); > +send_msg: > if (msg->len != 0) { > /* Discard request (see iproto_enqueue_batch()). */ > msg->p_ibuf->rpos += msg->len;