Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v2 2/3] console: do not use netbox for console text connections
Date: Thu, 29 Mar 2018 16:03:56 +0300	[thread overview]
Message-ID: <20180329130356.GB21697@atlas> (raw)
In-Reply-To: <7bbc3f973856120f5394f5193d5f02b538606195.1522243429.git.v.shpilevoy@tarantool.org>

* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [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

  reply	other threads:[~2018-03-29 13:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 13:35 [tarantool-patches] [PATCH v2 0/3] " Vladislav Shpilevoy
2018-03-28 13:35 ` [tarantool-patches] [PATCH v2 1/3] netbox: allow to create a netbox connection from existing socket Vladislav Shpilevoy
2018-03-29 13:03   ` [tarantool-patches] " Konstantin Osipov
2018-03-28 13:35 ` [tarantool-patches] [PATCH v2 2/3] console: do not use netbox for console text connections Vladislav Shpilevoy
2018-03-29 13:03   ` Konstantin Osipov [this message]
2018-03-28 13:35 ` [tarantool-patches] [PATCH v2 3/3] netbox: deprecate console support Vladislav Shpilevoy

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=20180329130356.GB21697@atlas \
    --to=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH v2 2/3] console: do not use netbox for console text connections' \
    /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