[Tarantool-patches] [PATCH 18/20] net.box: rewrite iproto handlers in C

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Wed Aug 4 02:08:25 MSK 2021


Thanks for the patch!

> diff --git a/src/box/lua/net_box.c b/src/box/lua/net_box.c
> index 85a45c54b979..fde2a8772890 100644
> --- a/src/box/lua/net_box.c
> +++ b/src/box/lua/net_box.c
> @@ -1800,6 +1759,188 @@ netbox_dispatch_response_console(struct lua_State *L,
>  	netbox_request_complete(request);
>  }
>  
> +/*
> + * Performs an authorization request for an iproto connection.
> + * Takes user, password, salt, request registry, socket fd,
> + * send_buf (ibuf), recv_buf (ibuf), timeout.
> + * Returns schema_version on success, nil and error on failure.
> + */
> +static int
> +netbox_iproto_auth(struct lua_State *L)
> +{
> +	size_t user_len;
> +	const char *user = lua_tolstring(L, 1, &user_len);
> +	size_t password_len;
> +	const char *password = lua_tolstring(L, 2, &password_len);
> +	size_t salt_len;
> +	const char *salt = lua_tolstring(L, 3, &salt_len);
> +	if (salt_len < SCRAMBLE_SIZE)
> +		return luaL_error(L, "Invalid salt");
> +	struct netbox_registry *registry = luaT_check_netbox_registry(L, 4);
> +	int fd = lua_tointeger(L, 5);
> +	struct ibuf *send_buf = (struct ibuf *) lua_topointer(L, 6);
> +	struct ibuf *recv_buf = (struct ibuf *) lua_topointer(L, 7);
> +	double timeout = (!lua_isnoneornil(L, 8) ?
> +			  lua_tonumber(L, 8) : TIMEOUT_INFINITY);

Timeout is never passed, it is always TIMEOUT_INFINITY. The same in
netbox_iproto_schema and netbox_iproto_loop.


More information about the Tarantool-patches mailing list