diff --git a/scheme/httpd/surflets/surflet-handler.scm b/scheme/httpd/surflets/surflet-handler.scm index d012aa5..2b3eb97 100644 --- a/scheme/httpd/surflets/surflet-handler.scm +++ b/scheme/httpd/surflets/surflet-handler.scm @@ -181,6 +181,7 @@ (with-cwd surflet-path (begin (register-instance! session-id) + (session-adjust-timeout! session-id) (resume s-req))) (bad-request path-string s-req))) (bad-request path-string s-req))) @@ -201,21 +202,19 @@ (session (session-lookup session-id))) ;; the instance might be deleted in the meanwhile (if session - (begin - (session-adjust-timeout! session-id) - (let ((continuations-table (session-continuation-table session)) - (continuation-table-lock (session-continuation-table-lock session)) - (continuation-counter (session-next-continuation-counter session))) - (let ((continuation-id - (with-lock continuation-table-lock - (let ((c-id (generate-new-table-id continuations-table))) - (table-set! continuations-table c-id return) - c-id)))) - (let ((new-url (make-resume-url (session-surflet-name session) - session-id - continuation-counter - continuation-id))) - (make-http-response (response-maker new-url)))))) + (let ((continuations-table (session-continuation-table session)) + (continuation-table-lock (session-continuation-table-lock session)) + (continuation-counter (session-next-continuation-counter session))) + (let ((continuation-id + (with-lock continuation-table-lock + (let ((c-id (generate-new-table-id continuations-table))) + (table-set! continuations-table c-id return) + c-id)))) + (let ((new-url (make-resume-url (session-surflet-name session) + session-id + continuation-counter + continuation-id))) + (make-http-response (response-maker new-url))))) (make-error-response (status-code not-found) #f "The URL refers to a SUrflet, whose session is no longer alive.")))))