sessionmanager: Use UUID for stream ids to clients, no math.random anymore :)

Sat, 03 Oct 2009 18:40:47 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 03 Oct 2009 18:40:47 +0100
changeset 1873
3b770710a1ee
parent 1872
1905eca82ddf
child 1874
262ea889016f

sessionmanager: Use UUID for stream ids to clients, no math.random anymore :)

core/sessionmanager.lua file | annotate | diff | comparison | revisions
--- a/core/sessionmanager.lua	Sat Oct 03 02:41:28 2009 +0100
+++ b/core/sessionmanager.lua	Sat Oct 03 18:40:47 2009 +0100
@@ -11,7 +11,6 @@
 local tonumber, tostring = tonumber, tostring;
 local ipairs, pairs, print, next= ipairs, pairs, print, next;
 local collectgarbage = collectgarbage;
-local m_random = import("math", "random");
 local format = import("string", "format");
 
 local hosts = hosts;
@@ -168,7 +167,7 @@
 	session.host = attr.to or error("Client failed to specify destination hostname");
 	session.host = nameprep(session.host);
 	session.version = tonumber(attr.version) or 0;
-	session.streamid = m_random(1000000, 99999999);
+	session.streamid = uuid_generate();
 	(session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host);
 	
 	send("<?xml version='1.0'?>");

mercurial