# HG changeset patch # User Kim Alvefur # Date 1527569512 -7200 # Node ID 4d7a822e837f9ab9a3bc4d4e2139869cd7203fc0 # Parent b67a861e883e525c45b1c7132e20065ddaeef84f sessionmanager: Generate shorter random resoures diff -r b67a861e883e -r 4d7a822e837f core/sessionmanager.lua --- a/core/sessionmanager.lua Sat Jun 02 20:38:19 2018 +0200 +++ b/core/sessionmanager.lua Tue May 29 06:51:52 2018 +0200 @@ -20,7 +20,7 @@ local config_get = require "core.configmanager".get; local resourceprep = require "util.encodings".stringprep.resourceprep; local nodeprep = require "util.encodings".stringprep.nodeprep; -local uuid_generate = require "util.uuid".generate; +local generate_identifier = require "util.id".short; local initialize_filters = require "util.filters".initialize; local gettime = require "socket".gettime; @@ -138,7 +138,7 @@ end resource = resourceprep(resource); - resource = resource ~= "" and resource or uuid_generate(); + resource = resource ~= "" and resource or generate_identifier(); --FIXME: Randomly-generated resources must be unique per-user, and never conflict with existing if not hosts[session.host].sessions[session.username] then @@ -152,7 +152,7 @@ local policy = config_get(session.host, "conflict_resolve"); local increment; if policy == "random" then - resource = uuid_generate(); + resource = generate_identifier(); increment = true; elseif policy == "increment" then increment = true; -- TODO ping old resource