Diff

core/sessionmanager.lua @ 8872:4d7a822e837f

sessionmanager: Generate shorter random resoures
author Kim Alvefur <zash@zash.se>
date Tue, 29 May 2018 06:51:52 +0200
parent 8717:9ddd0fbbe53a
child 9062:1b272b51ae0f
line wrap: on
line diff
--- 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