version 1.3, 2010/01/11 05:02:27
|
version 1.4, 2010/12/10 23:28:09
|
Line 34 use threads::shared;
|
Line 34 use threads::shared;
|
## |
## |
my %opts = &fetchOptions( ); |
my %opts = &fetchOptions( ); |
my $pidFile = "/var/run/telnetbbs.pid"; |
my $pidFile = "/var/run/telnetbbs.pid"; |
my @nodes = ( ); |
|
my $EOL = "\015\012"; |
my $EOL = "\015\012"; |
|
|
## |
## |
## These will be moved in to a config file |
## These will be moved in to a config file |
## |
## |
my $DISPLAY = ":1018.0"; |
my $DISPLAY = ":0.0"; |
my $BBS_NAME = "Hell's Dominion BBS"; |
my $BBS_NAME = "Hell's Dominion BBS"; |
my $BBS_NODE = 0; |
my $BBS_NODE = 0; |
my $DBCONF = "/tmp/dosbox-__NODE__.conf"; |
my $DBCONF = "/tmp/dosbox-__NODE__.conf"; |
my $BBS_CMD = "DISPLAY=$DISPLAY /usr/bin/dosbox -conf "; |
my $BBS_CMD = "DISPLAY=$DISPLAY /usr/bin/dosbox -conf "; |
my $LOG = "/var/log/bbs.log"; |
my $LOG = "/var/log/bbs.log"; |
my $MAX_NODE = 6; |
my $MAX_NODE = 1; |
my $DOSBOXT = "dosbox.conf.template"; |
my $DOSBOXT = "dosbox.conf.template"; |
my $BASE_PORT = 5000; |
my $BASE_PORT = 5000; |
|
|
Line 81 local $SIG{HUP} = $SIG{INT} = $SIG{TERM
|
Line 80 local $SIG{HUP} = $SIG{INT} = $SIG{TERM
|
## |
## |
## Start the network server |
## Start the network server |
## |
## |
my $netThread = threads->create( \&startNetServer ); |
my $netThread = threads->create( \&startNetServer( ) ); |
|
|
|
|
while( 1 ) { sleep 1; } |
while( 1 ) { sleep 1; } |
|
|
Line 111 sub startNetServer
|
Line 111 sub startNetServer
|
{ |
{ |
my $hostConnection; |
my $hostConnection; |
my $childPID; |
my $childPID; |
my $port = $opts{'port'} || 23; |
my $port = $opts{'port'} || 23; |
|
my @nodes = ( ); |
|
|
my $server = IO::Socket::INET->new( |
my $server = IO::Socket::INET->new( |
LocalPort => $port, |
LocalPort => $port, |
Line 139 sub startNetServer
|
Line 140 sub startNetServer
|
if ( ! $nodes[$_] ) |
if ( ! $nodes[$_] ) |
{ |
{ |
$node = $BBS_NODE = $_; |
$node = $BBS_NODE = $_; |
$nodes[$_]++; |
$nodes[$node]++; |
} |
} |
} |
} |
|
|
|
print STDOUT "Node Status: \n" . Dumper( @nodes ); |
|
|
## |
## |
## Create our dosbox config |
## Create our dosbox config |
## |
## |
Line 225 sub startNetServer
|
Line 228 sub startNetServer
|
{ |
{ |
print $hostConnection $byte; |
print $hostConnection $byte; |
} |
} |
kill( "TERM" => $childPID ); |
$nodes[$BBS_NODE] = 0; |
|
print "Post-Disconnect Node Status: \n" . Dumper( @nodes ); |
|
kill( "TERM" => $kidpid ); |
} |
} |
else |
else |
{ |
{ |