Changeset 20972
- Timestamp:
- Dec 12, 2008, 2:41:15 PM (17 years ago)
- Location:
- trunk/Nebulous-Server/lib/Nebulous
- Files:
-
- 2 edited
-
Server.pm (modified) (4 diffs)
-
Server/SOAP.pm (modified) (5 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 -
trunk/Nebulous-Server/lib/Nebulous/Server/SOAP.pm
r13111 r20972 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SOAP.pm,v 1. 4 2007-05-02 00:42:52jhoblitt Exp $3 # $Id: SOAP.pm,v 1.5 2008-12-13 00:41:15 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server::SOAP; … … 17 17 our $AUTOLOAD; 18 18 19 our @args;19 our $config; 20 20 our $neb; 21 21 22 sub new_on_init { 22 23 sub new_on_init 24 { 23 25 my $self = shift; 24 26 … … 27 29 require Apache2::ServerUtil; 28 30 29 @args = @_;31 $config = shift; 30 32 31 33 my $s = Apache2::ServerUtil->server; … … 35 37 } 36 38 37 sub init { 39 40 sub init 41 { 38 42 my $self = shift; 39 43 40 $neb = Nebulous::Server->new (@args);44 $neb = Nebulous::Server->new_from_config($config); 41 45 42 46 return Apache2::Const::OK; 43 47 } 44 48 45 sub AUTOLOAD { 49 50 sub AUTOLOAD 51 { 46 52 my $self = shift; 47 53 … … 76 82 } 77 83 84 78 85 1;
Note:
See TracChangeset
for help on using the changeset viewer.
