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

File diff suppressed because it is too large Load Diff

View File

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