Index: commonmod.scm
==================================================================
--- commonmod.scm
+++ commonmod.scm
@@ -318,11 +318,11 @@
;; Convert strings like "5s 2h 3m" => 60x60x2 + 3x60 + 5
(define (common:hms-string->seconds tstr)
(let ((parts (string-split-fields "\\w+" tstr))
(time-secs 0)
;; s=seconds, m=minutes, h=hours, d=days, M=months, y=years, w=weeks
- (trx (regexp "(\\d+)([smhdMyw])")))
+ (trx (regexp "^(\\d+)([smhdMyw])$")))
(for-each (lambda (part)
(let ((match (string-match trx part)))
(if match
(let ((val (string->number (cadr match)))
(unt (caddr match)))
@@ -334,11 +334,14 @@
((h) 3600)
((d) 86400)
((w) 604800)
((M) 2628000) ;; aproximately one month
((y) 31536000)
- (else #f))))))))))
+ (else
+ 0)))))))
+ (print "ERROR: can't parse timestring "tstr", component "part)
+ )))
parts)
time-secs))
(define (seconds->hr-min-sec secs)
(let* ((hrs (quotient secs 3600))
Index: server.scm
==================================================================
--- server.scm
+++ server.scm
@@ -731,15 +731,18 @@
;; timeout is hms string: 1h 5m 3s, default is 1 minute
;; This is currently broken. Just use the number of hours with no unit.
;; Default is 60 seconds.
;;
(define (server:expiration-timeout)
- (let ((tmo (configf:lookup *configdat* "server" "timeout")))
- (if (and (string? tmo)
- (common:hms-string->seconds tmo)) ;; BUG: hms-string->seconds is broken, if given "10" returns 0. Also, it doesn't belong in this logic unless the string->number is changed below
- (* 3600 (string->number tmo))
- 600)))
+ (let* ((tmo (configf:lookup *configdat* "server" "timeout")))
+ (if (string? tmo)
+ (let* ((num (string->number tmo)))
+ (if num
+ (* 3600 num)
+ (common:hms-string->seconds tmo)))
+ 600 ;; this is the default
+ )))
(define (server:get-best-guess-address hostname)
(let ((res #f))
(for-each
(lambda (adr)
Index: tcp-transportmod.scm
==================================================================
--- tcp-transportmod.scm
+++ tcp-transportmod.scm
@@ -104,11 +104,11 @@
(last-serv-start 0)
)
;; parameters
;;
-(define tt-server-timeout-param (make-parameter 300))
+(define tt-server-timeout-param (make-parameter 600))
;; make ttdat visible
(define *server-info* #f)
(define (tt:make-remote areapath)
@@ -275,11 +275,13 @@
(sorted (sort sdats (lambda (a b)
(< (list-ref a 2)(list-ref b 2)))))
(count 0))
(for-each
(lambda (rec)
- (debug:print 0 *default-log-port* "SERVER #"count": "(string-intersperse (map conc sorted) ", "))
+ (if (or (> (length sorted) 1)
+ (common:low-noise-print 120 "server info sorted"))
+ (debug:print 0 *default-log-port* "SERVER #"count": "(string-intersperse (map conc sorted) ", ")))
(set! count (+ count 1)))
sorted)
sorted))
(define (tt:get-current-server-info ttdat dbfname)
@@ -410,11 +412,12 @@
(set! db-locked-in #t)
#t)
(begin
(debug:print 0 *default-log-port* "Failed to get server lock for "dbfname)
#f))))))
- (if res
+ (if (and res
+ (common:low-noise-print 120 "top server message"))
(debug:print-info 0 *default-log-port* "Keep running, I'm the top server for "
dbfname" on "(tt-host ttdat)":"(tt-port ttdat)))
res))
(else
(debug:print-info 0 *default-log-port* "I'm not the lead server: "servers)
Index: utils/viewscreen
==================================================================
--- utils/viewscreen
+++ utils/viewscreen
@@ -16,11 +16,11 @@
#
# You should have received a copy of the GNU General Public License
# along with Megatest. If not, see .
if ! type screen &> /dev/null;then
- xterm -geometry 180x20 -e "$*;echo Press any key to continue;bash -c 'read -n 1 -s'"
+ xterm -geometry 180x20 -e "$*;echo Press any key to continue;bash -c 'read -n 1 -s'" &
exit
fi
if [[ $(screen -list | egrep 'Attached|Detached'|awk '{print $1}') == "" ]];then
# echo "No screen found for displaying to. Run \"screen\" in an xterm"
@@ -31,6 +31,6 @@
screen -X hardstatus alwayslastline
screen -X hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W} %c %{g}]'
fi
cmd="cd $PWD;$*"
-screen -X screen bash -c "$cmd;echo \"Press any key to continue, ctrl-f to see other windows\";bash -c 'read -n 1 -s'"
+screen -X screen bash -c "$cmd;echo \"Press any key to continue, ctrl-f to see other windows\";bash -c 'read -n 1 -s'" &