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 C273D28543 for ; Thu, 29 Mar 2018 09:03:58 -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 mUnrBPTv3tIH for ; Thu, 29 Mar 2018 09:03:58 -0400 (EDT) Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (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 7C78B284AE for ; Thu, 29 Mar 2018 09:03:58 -0400 (EDT) Date: Thu, 29 Mar 2018 16:03:56 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH v2 2/3] console: do not use netbox for console text connections Message-ID: <20180329130356.GB21697@atlas> References: <7bbc3f973856120f5394f5193d5f02b538606195.1522243429.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7bbc3f973856120f5394f5193d5f02b538606195.1522243429.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: tarantool-patches@freelists.org Cc: Vladislav Shpilevoy * Vladislav Shpilevoy [18/03/28 16:50]: You mentioned you were going to get rid of the read() to detect sigpipe, and investigate sigpipe problem more thoroughly. Please do. > + write = function(self, text) > + -- It is the hack to protect from SIGPIPE, which is > + -- not ignored under debugger (gdb, lldb) on send in > + -- a socket, that is actually closed. If a socket is > + -- readable and read() returns nothing then the socket > + -- is closed, and writing into it will raise SIGPIPE. > + if self._socket:readable(0) then > + local rc = self._socket:read({chunk = 1}) > + if not rc or rc == '' then > + return nil > + else > + assert(#rc == 1) > + -- Make the char be unread. > + self._socket.rbuf.wpos = self._socket.rbuf.wpos - 1 > + end > + end > + return self._socket:write(text) -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov