IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20972


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

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

Location:
trunk/Nebulous-Server/lib/Nebulous
Files:
2 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
  • trunk/Nebulous-Server/lib/Nebulous/Server/SOAP.pm

    r13111 r20972  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: SOAP.pm,v 1.4 2007-05-02 00:42:52 jhoblitt Exp $
     3# $Id: SOAP.pm,v 1.5 2008-12-13 00:41:15 jhoblitt Exp $
    44
    55package Nebulous::Server::SOAP;
     
    1717our $AUTOLOAD;
    1818
    19 our @args;
     19our $config;
    2020our $neb;
    2121
    22 sub new_on_init {
     22
     23sub new_on_init
     24{
    2325    my $self = shift;
    2426
     
    2729    require Apache2::ServerUtil;
    2830
    29     @args = @_;
     31    $config = shift;
    3032
    3133    my $s = Apache2::ServerUtil->server;
     
    3537}
    3638
    37 sub init {
     39
     40sub init
     41{
    3842    my $self = shift;
    3943
    40     $neb = Nebulous::Server->new(@args);       
     44    $neb = Nebulous::Server->new_from_config($config);       
    4145
    4246    return Apache2::Const::OK;
    4347}
    4448
    45 sub AUTOLOAD {
     49
     50sub AUTOLOAD
     51{
    4652    my $self = shift;
    4753
     
    7682}
    7783
     84
    78851;
Note: See TracChangeset for help on using the changeset viewer.