Rename misleading {SET,GET}-SURFLET-DATA to {SET,GET}-SESSION-DATA, as the data is specific to a session and not to a surflet.
This commit is contained in:
parent
cacf6aeaa8
commit
3f1542466c
|
@ -73,8 +73,8 @@
|
||||||
send/finish ;send and finish
|
send/finish ;send and finish
|
||||||
send ;just send (no finish, no suspend)
|
send ;just send (no finish, no suspend)
|
||||||
send-error ;send error response
|
send-error ;send error response
|
||||||
set-surflet-data!
|
set-session-data!
|
||||||
get-surflet-data
|
get-session-data
|
||||||
adjust-timeout ;adjusts timeout of current session
|
adjust-timeout ;adjusts timeout of current session
|
||||||
;Without `!' because PLT
|
;Without `!' because PLT
|
||||||
;doesn't have it.
|
;doesn't have it.
|
||||||
|
@ -191,8 +191,8 @@
|
||||||
(case-returned-via :syntax)
|
(case-returned-via :syntax)
|
||||||
make-callback
|
make-callback
|
||||||
|
|
||||||
set-surflet-data!
|
set-session-data!
|
||||||
get-surflet-data))
|
get-session-data))
|
||||||
|
|
||||||
(define-structure surflets surflets-interface
|
(define-structure surflets surflets-interface
|
||||||
(open surflet-handler/surflets
|
(open surflet-handler/surflets
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
(make-integer-table) ; continuation table
|
(make-integer-table) ; continuation table
|
||||||
(make-lock) ; continuation table lock
|
(make-lock) ; continuation table lock
|
||||||
(make-thread-safe-counter) ; continuation counter
|
(make-thread-safe-counter) ; continuation counter
|
||||||
#f)) ; surflet-data
|
#f)) ; session-data
|
||||||
(release-lock *session-table-lock*)
|
(release-lock *session-table-lock*)
|
||||||
(register-instance! session-id)
|
(register-instance! session-id)
|
||||||
|
|
||||||
|
@ -406,21 +406,21 @@
|
||||||
(table-set! continuation-table continuation-id #f)))
|
(table-set! continuation-table continuation-id #f)))
|
||||||
(release-lock continuation-table-lock)))))
|
(release-lock continuation-table-lock)))))
|
||||||
|
|
||||||
;;; SET-SURFLET-DATA!, GET-SURFLET-DATA
|
;;; SET-SESSION-DATA!, GET-SESSION-DATA
|
||||||
;; Access to arbitrary data stored along with current session (no
|
;; Access to arbitrary data stored along with current session (no
|
||||||
;; locking!).
|
;; locking!).
|
||||||
(define (set-surflet-data! new-data)
|
(define (set-session-data! new-data)
|
||||||
(let ((session (session-lookup (instance-session-id))))
|
(let ((session (session-lookup (instance-session-id))))
|
||||||
(if session
|
(if session
|
||||||
(begin
|
(begin
|
||||||
(set-session-surflet-data! session new-data)
|
(set-session-session-data! session new-data)
|
||||||
#t)
|
#t)
|
||||||
#f)))
|
#f)))
|
||||||
|
|
||||||
(define (get-surflet-data)
|
(define (get-session-data)
|
||||||
(let ((session (session-lookup (instance-session-id))))
|
(let ((session (session-lookup (instance-session-id))))
|
||||||
(if session
|
(if session
|
||||||
(session-surflet-data session)
|
(session-session-data session)
|
||||||
(error "Instance no longer alive."))))
|
(error "Instance no longer alive."))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -598,14 +598,14 @@
|
||||||
(make-session surflet-name memo
|
(make-session surflet-name memo
|
||||||
continuation-table continuation-table-lock
|
continuation-table continuation-table-lock
|
||||||
continuation-counter
|
continuation-counter
|
||||||
surflet-data)
|
session-data)
|
||||||
session?
|
session?
|
||||||
(surflet-name session-surflet-name)
|
(surflet-name session-surflet-name)
|
||||||
(memo session-memo set-session-memo!)
|
(memo session-memo set-session-memo!)
|
||||||
(continuation-table session-continuation-table)
|
(continuation-table session-continuation-table)
|
||||||
(continuation-table-lock session-continuation-table-lock)
|
(continuation-table-lock session-continuation-table-lock)
|
||||||
(continuation-counter session-continuation-counter)
|
(continuation-counter session-continuation-counter)
|
||||||
(surflet-data session-surflet-data set-session-surflet-data!))
|
(session-data session-session-data set-session-session-data!))
|
||||||
|
|
||||||
;;; MEMO: Information for session surveiller about session status
|
;;; MEMO: Information for session surveiller about session status
|
||||||
(define-record-type memo :memo
|
(define-record-type memo :memo
|
||||||
|
|
|
@ -27,11 +27,11 @@
|
||||||
(counter state:counter set-state:counter!))
|
(counter state:counter set-state:counter!))
|
||||||
|
|
||||||
(define (state-file-name)
|
(define (state-file-name)
|
||||||
(state:file-name (get-surflet-data)))
|
(state:file-name (get-session-data)))
|
||||||
(define (state-file-names-to-delete)
|
(define (state-file-names-to-delete)
|
||||||
(state:file-names-to-delete (get-surflet-data)))
|
(state:file-names-to-delete (get-session-data)))
|
||||||
(define (state-counter)
|
(define (state-counter)
|
||||||
(state:counter (get-surflet-data)))
|
(state:counter (get-session-data)))
|
||||||
|
|
||||||
;; Leave this global. Servers are running on a single system.
|
;; Leave this global. Servers are running on a single system.
|
||||||
(define gnuplot #f) ;; Set in main.
|
(define gnuplot #f) ;; Set in main.
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
(file-executable? file-name)))
|
(file-executable? file-name)))
|
||||||
|
|
||||||
(define (new-profile req)
|
(define (new-profile req)
|
||||||
(let ((state (get-surflet-data)))
|
(let ((state (get-session-data)))
|
||||||
(format #t "profiling...~%")
|
(format #t "profiling...~%")
|
||||||
(obtain-lock lock)
|
(obtain-lock lock)
|
||||||
(profile-space (state:file-name state))
|
(profile-space (state:file-name state))
|
||||||
|
@ -262,7 +262,7 @@ plot '~a' title 'SUrflet Profiling ~a' with lines"
|
||||||
(profile req "Profiling state reseted."))
|
(profile req "Profiling state reseted."))
|
||||||
|
|
||||||
(define (add-file-name-to-delete! file-name)
|
(define (add-file-name-to-delete! file-name)
|
||||||
(let ((state (get-surflet-data)))
|
(let ((state (get-session-data)))
|
||||||
(set-state:file-names-to-delete!
|
(set-state:file-names-to-delete!
|
||||||
state
|
state
|
||||||
(cons file-name
|
(cons file-name
|
||||||
|
@ -274,7 +274,7 @@ plot '~a' title 'SUrflet Profiling ~a' with lines"
|
||||||
(for-each delete-filesys-object file-names-to-delete))))
|
(for-each delete-filesys-object file-names-to-delete))))
|
||||||
|
|
||||||
(define (reset-profiling-state!)
|
(define (reset-profiling-state!)
|
||||||
(let ((state (get-surflet-data)))
|
(let ((state (get-session-data)))
|
||||||
(set-state:counter! state 0)
|
(set-state:counter! state 0)
|
||||||
(delete-files state)
|
(delete-files state)
|
||||||
(set-state:file-name! state
|
(set-state:file-name! state
|
||||||
|
@ -285,7 +285,7 @@ plot '~a' title 'SUrflet Profiling ~a' with lines"
|
||||||
(define (reset-and-return-to-main-page req)
|
(define (reset-and-return-to-main-page req)
|
||||||
;; Overhead included :-|
|
;; Overhead included :-|
|
||||||
(reset-profiling-state!)
|
(reset-profiling-state!)
|
||||||
(delete-files (get-surflet-data))
|
(delete-files (get-session-data))
|
||||||
(return-to-main-page req))
|
(return-to-main-page req))
|
||||||
|
|
||||||
(define (return-to-main-page req)
|
(define (return-to-main-page req)
|
||||||
|
@ -304,10 +304,10 @@ plot '~a' title 'SUrflet Profiling ~a' with lines"
|
||||||
(if (string=? convert "")
|
(if (string=? convert "")
|
||||||
(set! use-convert? #f)
|
(set! use-convert? #f)
|
||||||
(set! use-convert? #t))))
|
(set! use-convert? #t))))
|
||||||
(set-surflet-data! (make-state #f #f 0))
|
(set-session-data! (make-state #f #f 0))
|
||||||
(reset-profiling-state!)
|
(reset-profiling-state!)
|
||||||
;; Remove state files if user did not do it.
|
;; Remove state files if user did not do it.
|
||||||
(add-finalizer! (get-surflet-data) delete-files)
|
(add-finalizer! (get-session-data) delete-files)
|
||||||
(profile req))
|
(profile req))
|
||||||
|
|
||||||
(define (search-executable exec-name)
|
(define (search-executable exec-name)
|
||||||
|
|
Loading…
Reference in New Issue