Commit febd8fa3 authored by Gary Wong's avatar Gary Wong

Arrange for the TCP proxy to start and die with the testbed.

parent dd445ae2
......@@ -117,6 +117,11 @@ case "$1" in
@prefix@/sbin/portal_daemon
fi
if [ -x @prefix@/sbin/tcppd ]; then
echo -n " tcppd"
@prefix@/sbin/tcppd &
fi
#
# Could trigger experiment creation, so make sure everything
# else is setup first; i.e., run this last!
......@@ -190,6 +195,9 @@ case "$1" in
if [ -r /var/run/portal_daemon.pid ]; then
kill `cat /var/run/portal_daemon.pid`
fi
if [ -r /var/run/tcppd.pid ]; then
kill `cat /var/run/tcppd.pid`
fi
;;
*)
......
......@@ -66,6 +66,14 @@ my $ctrl = new IO::Socket::INET( LocalAddr => '127.0.0.1',
Blocking => 0 )
or die "socket: $!\n";
# Write our PID to a known location (to assist those who would kill us).
# Don't bother attempting to use the PID file as a lock -- the socket
# we just listened on makes a better mutex than a file would.
sysopen( PIDFILE, "/var/run/tcppd.pid", O_WRONLY | O_CREAT) ||
fatal("Couldn't create '$pidfile': $? $!\n");
print PIDFILE "$$";
close PIDFILE;
my $readlist = IO::Select->new( $ctrl )
or die "select: $!\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment