Index: trunk/phase3/maintenance/locking/LockServerDaemon.php |
— | — | @@ -58,6 +58,15 @@ |
59 | 59 | if ( self::$instance ) { |
60 | 60 | throw new Exception( 'LockServer already initialized.' ); |
61 | 61 | } |
| 62 | + foreach ( array( 'address', 'port', 'authKey' ) as $par ) { |
| 63 | + if ( !isset( $config[$par] ) ) { |
| 64 | + die( "Usage: php LockServerDaemon.php " . |
| 65 | + "--address <address> --port <port> --authkey <key> " . |
| 66 | + "[--connTimeout <seconds>] [--lockTimeout <seconds>] " . |
| 67 | + "[--maxLocks <integer>] [--maxClients <integer>] [--maxBacklog <integer>]" |
| 68 | + ); |
| 69 | + } |
| 70 | + } |
62 | 71 | self::$instance = new self( $config ); |
63 | 72 | return self::$instance; |
64 | 73 | } |
— | — | @@ -66,17 +75,11 @@ |
67 | 76 | * @params $config Array |
68 | 77 | */ |
69 | 78 | protected function __construct( array $config ) { |
70 | | - $required = array( 'address', 'port', 'authKey' ); |
71 | | - foreach ( $required as $par ) { |
72 | | - if ( !isset( $config[$par] ) ) { |
73 | | - throw new Exception( "Parameter '$par' must be specified." ); |
74 | | - } |
75 | | - } |
76 | | - |
| 79 | + // Required parameters... |
77 | 80 | $this->address = $config['address']; |
78 | 81 | $this->port = $config['port']; |
79 | 82 | $this->authKey = $config['authKey']; |
80 | | - |
| 83 | + // Parameters with defaults... |
81 | 84 | $connTimeout = isset( $config['connTimeout'] ) |
82 | 85 | ? $config['connTimeout'] |
83 | 86 | : 1.5; |
— | — | @@ -92,7 +95,7 @@ |
93 | 96 | : 5000; |
94 | 97 | $this->maxClients = isset( $config['maxClients'] ) |
95 | 98 | ? $config['maxClients'] |
96 | | - : 100; |
| 99 | + : 1000; // less than default FD_SETSIZE |
97 | 100 | $this->maxBacklog = isset( $config['maxBacklog'] ) |
98 | 101 | ? $config['maxBacklog'] |
99 | 102 | : 10; |