#!/usr/local/bin/tops -s /usr/local/tops/sys -u /opt/mytops/usr/
{
   File tops_https_test
   March 2011

   Copyright (C) 2011  Dale R. Williamson

   Test tops_https by continually sending HTTP requests.
}
\-----------------------------------------------------------------------

   SSL not
   IF " tops_https_test: OpenSSL functions are missing" . nl HALT THEN

   CATMSG push no catmsg

\-----------------------------------------------------------------------

\  Logging.
   keys? not
   IF
    \ A log file is defined for SYSOUT using word set_sysout:
      "HOME" env "tops_https_test.log" catpath "LOG" book LOG set_sysout
      LOG "memlog" "LOG" bank

    \ Log memory usage at 9 minutes past every hour:
      "LOGMEM" everyhour "memlog" ptr 9 LOGMEM

    \ Display some starting lines in the log file:
      "-" 72 cats nl dot nl "PID " getpid intstr + spaced date + dot nl
   THEN

\-----------------------------------------------------------------------
\  Words.

   inline: TEST ( --- ) \ fetch data for tops_https_test
      HTTPS_TEST (qS) \ word in mytops/usr/uboot.v
      (qS) . nl
   end

\  Start running TEST in the multitasker:
   1 600 / "TEST" PLAY

\-----------------------------------------------------------------------

   pull catmsg

   9877 nextport "PORT" book
   " tops_https_test: listening on port" . PORT .i nl

   host "plunger" = IF 5 "NIST_DELTA" ELSE 5 "NIST_SYNC" THEN ALARM

\  Start the server (only used for maintenance):
   "*" PORT (qIPaddr nPort) keys?
   IF
    \ This portion runs during interactive debugging when this file
    \ is sourced at the ready prompt:
      (qIPaddr nPort) SERVER
   ELSE
      (qIPaddr nPort) DSERVER
   THEN

   private halt
