IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 12, 2008, 2:41:15 PM (18 years ago)
Author:
jhoblitt
Message:

rework Nebulous::Server::SOAP configuration
fix db hashing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r20965 r20972  
    11# Copyright (c) 2004-2008  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.94 2008-12-12 21:13:41 jhoblitt Exp $
     3# $Id: Server.pm,v 1.95 2008-12-13 00:41:15 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    3838    my $config = Nebulous::Server::Config->new( @_ );
    3939
     40    return $class->new_from_config($config);
     41}
     42
     43
     44sub new_from_config
     45{
     46    my ($class, $config) = @_;
     47
    4048    # log4perl is not avaliable until we call init()
    4149    Nebulous::Server::Log->init($config);
     
    5260
    5361    $log->debug( "leaving" );
    54    
     62
    5563    return $self;
    5664}
    57 
    5865
    5966sub db
     
    6875    if (defined $key) {
    6976        # 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;
    7180    }
    7281
Note: See TracChangeset for help on using the changeset viewer.