use generate to make session ids
							parent
							
								
									63b84d4f2b
								
							
						
					
					
						commit
						ce94ca20dc
					
				| 
						 | 
					@ -204,4 +204,3 @@ SYMBOL: model
 | 
				
			||||||
    ] [
 | 
					    ] [
 | 
				
			||||||
        drop
 | 
					        drop
 | 
				
			||||||
    ] if ;
 | 
					    ] if ;
 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
USING: assocs calendar init kernel math.parser
 | 
					USING: assocs calendar init kernel math.parser
 | 
				
			||||||
namespaces random boxes alarms ;
 | 
					namespaces random boxes alarms combinators.lib ;
 | 
				
			||||||
IN: furnace.sessions
 | 
					IN: furnace.sessions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SYMBOL: sessions
 | 
					SYMBOL: sessions
 | 
				
			||||||
| 
						 | 
					@ -11,9 +11,8 @@ SYMBOL: sessions
 | 
				
			||||||
] "furnace.sessions" add-init-hook
 | 
					] "furnace.sessions" add-init-hook
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: new-session-id ( -- str )
 | 
					: new-session-id ( -- str )
 | 
				
			||||||
    4 big-random >hex
 | 
					    [ 4 big-random >hex ]
 | 
				
			||||||
    dup sessions get-global key?
 | 
					    [ sessions get-global key? not ] generate ;
 | 
				
			||||||
    [ drop new-session-id ] when ;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
TUPLE: session id namespace alarm user-agent ;
 | 
					TUPLE: session id namespace alarm user-agent ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue