Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH v2 1/4] console: forbid arbitrary session type setting
Date: Fri, 21 Dec 2018 14:17:41 +0300	[thread overview]
Message-ID: <20181221111741.5oi2scu5jlkunymh@esperanza> (raw)
In-Reply-To: <ec29126770e427e5030a35408073a137c2eb0dca.1544544183.git.v.shpilevoy@tarantool.org>

On Tue, Dec 11, 2018 at 07:10:20PM +0300, Vladislav Shpilevoy wrote:
> @@ -47,22 +47,33 @@ static const char *sessionlib_name = "box.session";
>  
>  /* Create session and pin it to fiber */
>  static int
> -lbox_session_create(struct lua_State *L)
> +lbox_session_create(struct lua_State *L, enum session_type type)
>  {
>  	struct session *session = fiber_get_session(fiber());
>  	if (session == NULL) {
>  		session = session_create_on_demand();
>  		if (session == NULL)
>  			return luaT_error(L);
> -		session->meta.fd = luaL_optinteger(L, 1, -1);
> +		session->meta.fd = lua_tointeger(L, 1);
>  	}
> -	/* If a session already exists, simply reset its type */
> -	session->type = STR2ENUM(session_type, luaL_optstring(L, 2, "console"));
> +	session->type = type;
>  
>  	lua_pushnumber(L, session->id);
>  	return 1;
>  }

If you didn't remove session_vtab registry, you wouldn't be needing this
patch. I don't think that narrowing functionality of an internal
function makes much sense on its own so please drop it if you agree to
leave the registry.

  reply	other threads:[~2018-12-21 11:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 16:10 [PATCH v2 0/4] Outdate binary session on disconnect Vladislav Shpilevoy
2018-12-11 16:10 ` [PATCH v2 1/4] console: forbid arbitrary session type setting Vladislav Shpilevoy
2018-12-21 11:17   ` Vladimir Davydov [this message]
2018-12-11 16:10 ` [PATCH v2 2/4] session: minimize number of session type resets Vladislav Shpilevoy
2018-12-11 16:10 ` [PATCH v2 3/4] session: store vtab in struct session Vladislav Shpilevoy
2018-12-21 11:04   ` Vladimir Davydov
2018-12-21 11:23     ` [tarantool-patches] " Vladislav Shpilevoy
2018-12-11 16:10 ` [PATCH v2 4/4] session: outdate a session of a closed connection 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=20181221111741.5oi2scu5jlkunymh@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [PATCH v2 1/4] console: forbid arbitrary session type setting' \
    /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