Index: http-transport.scm ================================================================== --- http-transport.scm +++ http-transport.scm @@ -71,10 +71,11 @@ #f))) (if ipstr ipstr hostn))) ;; hostname))) (start-port (portlogger:open-run-close portlogger:find-port)) (link-tree-path (configf:lookup *configdat* "setup" "linktree"))) ;; (set! db *inmemdb*) + (debug:print-info 0 "portlogger recommended port: " start-port) (root-path (if link-tree-path link-tree-path (current-directory))) ;; WARNING: SECURITY HOLE. FIX ASAP! (handle-directory spiffy-directory-listing) ;; http-transport:handle-directory) ;; simple-directory-handler) @@ -347,10 +348,11 @@ (if (and sdat (not changed) (> (- (current-seconds) start-time) 2)) sdat (begin + (debug:print-info 0 "Still waiting, last-sdat=" last-sdat) (sleep 4) (loop start-time (equal? sdat last-sdat) sdat)))))) (iface (car server-info)) Index: portlogger.scm ================================================================== --- portlogger.scm +++ portlogger.scm @@ -17,13 +17,17 @@ ;; lsof -i (define (portlogger:open-db fname) - (let* ((avail (tasks:wait-on-journal fname 10)) ;; wait up to about 10 seconds for the journal to go away + (let* ((avail (tasks:wait-on-journal fname 1 remove: #t)) ;; wait up to about 10 seconds for the journal to go away (exists (file-exists? fname)) - (db (sqlite3:open-database fname)) + (db (if avail + (sqlite3:open-database fname) + (begin + (system (conc "rm -f " fname)) + (sqlite3:open-database fname)))) (handler (make-busy-timeout 136000)) (canwrite (file-write-access? fname))) (sqlite3:set-busy-handler! db handler) (sqlite3:execute db "PRAGMA synchronous = 0;") (if (not exists) Index: tasks.scm ================================================================== --- tasks.scm +++ tasks.scm @@ -22,23 +22,24 @@ ;; Tasks db ;;====================================================================== ;; wait up to aprox n seconds for a journal to go away ;; -(define (tasks:wait-on-journal path n) +(define (tasks:wait-on-journal path n #!key (remove #f)) (let ((fullpath (conc path "-journal"))) (let loop ((journal-exists (file-exists? fullpath)) (count n)) ;; wait ten times ... (if journal-exists (if (> count 0) - #f (begin (thread-sleep! 1) (loop (file-exists? fullpath) - (- count 1)))) + (- count 1))) + (begin + (if remove (system (conc "rm -rf " path))) + #f)) #t)))) - ;; If file exists AND ;; file readable ;; ==> open it ;; If file exists AND