refactoring the sandbox

This commit is contained in:
Danny Yoo 2013-04-19 22:03:39 -06:00
parent 2d7e16bf22
commit f55723b332
4 changed files with 4301 additions and 4274 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
<script src="collects/library.js"></script>
<script src="easyXDM-min.js"></script>
<script src="repl.js"></script>
<script src="tests-base.js"></script>
<script src="tests.js"></script>
</head>
<body>
@ -15,6 +16,7 @@
<div id="is-running"></div>
<br/>
<div id="failure-index">Failures: </div>
<div id="report"></div>
<br/>
</body>

File diff suppressed because it is too large Load Diff

View File

@ -26,19 +26,22 @@
(let loop ()
(define eval
(parameterize ([sandbox-memory-limit (current-memory-limit)]
[sandbox-eval-limits '(+inf.0 256)]
[sandbox-output (current-output-port)]
[sandbox-network-guard my-network-guard])
(printf "memory limit: ~s mb\n" (sandbox-memory-limit))
(parameterize ([sandbox-memory-limit (current-memory-limit)]
[sandbox-eval-limits '(+inf.0 256)]
[sandbox-output (current-output-port)]
[sandbox-network-guard my-network-guard])
(printf "memory limit: ~s mb\n" (sandbox-memory-limit))
(define eval
(make-module-evaluator server-path
#:allow-read (list (build-path "/")))))
(printf "starting server thread\n")
(define server-thread (eval `(start-server #:port ,(current-port))))
(printf "thread started\n")
(with-handlers ([exn:fail? (lambda (exn)
(printf "server died prematurely? ~s\n" (exn-message exn)))])
(sync server-thread))
(printf "restarting server\n")
(loop))
#:allow-read (list (build-path "/"))))
(printf "starting server thread\n")
(eval
`(begin (define server-thread (start-server #:port ,(current-port)))
(printf "thread started\n")
(with-handlers ([exn:fail?
(lambda (exn)
(printf "server died prematurely? ~s\n"
(exn-message exn)))])
(sync server-thread))))
(printf "restarting server\n")
(loop)))