Changeset 20972 for trunk/Nebulous-Server/lib/Nebulous/Server.pm
- Timestamp:
- Dec 12, 2008, 2:41:15 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r20965 r20972 1 1 # Copyright (c) 2004-2008 Joshua Hoblitt 2 2 # 3 # $Id: Server.pm,v 1.9 4 2008-12-12 21:13:41jhoblitt Exp $3 # $Id: Server.pm,v 1.95 2008-12-13 00:41:15 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server; … … 38 38 my $config = Nebulous::Server::Config->new( @_ ); 39 39 40 return $class->new_from_config($config); 41 } 42 43 44 sub new_from_config 45 { 46 my ($class, $config) = @_; 47 40 48 # log4perl is not avaliable until we call init() 41 49 Nebulous::Server::Log->init($config); … … 52 60 53 61 $log->debug( "leaving" ); 54 62 55 63 return $self; 56 64 } 57 58 65 59 66 sub db … … 68 75 if (defined $key) { 69 76 # hash the key to select the correct database instance 70 $db_index = unpack("%20h", sha1_hex("$key")) % $config->n_db; 77 # only use the first 8 hex chars... have to be careful to avoid an int 78 # overflow here 79 $db_index = unpack("h8", sha1_hex("$key")) % $config->n_db; 71 80 } 72 81
Note:
See TracChangeset
for help on using the changeset viewer.
