[tarantool-patches] Re: [PATCH 3/3] box/lua/console: Verify remote protocol for compatibility

Cyrill Gorcunov gorcunov at gmail.com
Sat Jul 13 00:51:40 MSK 2019


On Fri, Jul 12, 2019 at 11:49:04PM +0300, Konstantin Osipov wrote:
> * Konstantin Osipov <kostja at tarantool.org> [19/07/12 23:47]:
> > > +local function output_verify_remote(greeting)
> > > +    --
> > > +    -- In case if remote peer is operating over
> > > +    -- old yaml protocol we are unable to decode
> > > +    -- it to non-yaml serializers.
> > > +    if greeting.protocol == 'Lua console' then
> > > +        local d = box.session.storage.console_output
> > > +        if d ~= nil and d["fmt"] == "lua" then
> > > +            local msg1 = "Peer uses deprecated '%s' protocol. "
> > > +            local msg2 = "Switch output to 'yaml' format to proceed."
> > > +            return false, msg1:format(greeting.protocol) .. msg2
> > > +        end
> > > +    end
> > > +    return true, nil
> > > +end
> > 
> > what is the problem with doing yaml.load and serpent.encode for
> > such peers?

'Lua console' proto is depecated, binary proto is preferred and
I think we may simply get rid it, otherwise a way more code is
needed here which I would try to escape.

> > 
> > What if it's a new peer but using yaml output?

Every new connection does this check so that if peer is
reporting old text protocol we refuse to connect until
local output set back to yaml.

> 
> Moreover, shouldn't the output setting affect only the local
> server output, but not subsequent console.connect() calls? 

Not sure I follow here. This code checks for reply from remote
peer, every output bound to a session, and every connection
is a new session (no?) thus we do test each time. Or you meant
something different?




More information about the Tarantool-patches mailing list