freeside/FS/bin freeside-selfservice-server,1.10,1.11
ivan
ivan at pouncequick.420.am
Mon Sep 6 05:44:20 PDT 2004
Update of /home/cvs/cvsroot/freeside/FS/bin
In directory pouncequick:/tmp/cvs-serv4452/FS/bin
Modified Files:
freeside-selfservice-server
Log Message:
self-service keepalives
Index: freeside-selfservice-server
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-selfservice-server,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- freeside-selfservice-server 6 Sep 2004 09:44:42 -0000 1.10
+++ freeside-selfservice-server 6 Sep 2004 12:44:17 -0000 1.11
@@ -8,7 +8,8 @@
# Proc::Daemon or somesuch
use strict;
-use vars qw( $Debug %kids $kids $max_kids $shutdown $log_file $ssh_pid );
+use vars qw( $Debug %kids $kids $max_kids $shutdown $log_file $ssh_pid
+ $keepalives );
use subs qw( lock_write unlock_write );
use Fcntl qw(:flock);
use POSIX qw(:sys_wait_h setsid);
@@ -29,6 +30,7 @@
$shutdown = 0;
$max_kids = '10'; #?
+$keepalives = 0; #let clientd turn it on, so we don't barf on old ones
$kids = 0;
my $user = shift or die &usage;
@@ -58,6 +60,7 @@
warn "entering main loop\n" if $Debug;
my $undisp = 0;
+ my $keepalive_count = 0;
my $s = IO::Select->new( $reader );
while (1) {
@@ -68,6 +71,10 @@
my @handles = $s->can_read(5);
unless ( @handles ) {
&shutdown if $shutdown;
+ if ( $keepalives && $keepalive_count++ > 10 ) {
+ $keepalive_count = 0;
+ nstore_fd( { _token => '_keepalive' }, $writer );
+ }
next;
}
@@ -90,6 +97,12 @@
warn "packet received\n".
join('', map { " $_=>$packet->{$_}\n" } keys %$packet )
if $Debug > 1;
+
+ if ( $packet->{_packet} eq '_enable_keepalive' ) {
+ warn "enabling keep alives\n" if $Debug;
+ $keepalives=1;
+ next;
+ }
#prevent runaway forking
my $warnkids = 0;
More information about the freeside-commits
mailing list