X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=8sync%2Fsystems%2Fwebsocket%2Fclient.scm;h=a6373845fcd7eb44a85f362c85c67adf208f62e5;hb=81f78003ebc436ac9c555bc2d54a7b5f562b1aba;hp=9f2b0f06807a1494e51e31c5c27113543885a6a6;hpb=715d98b09ba5745db5efc19e6d3de38e8eb38793;p=8sync.git diff --git a/8sync/systems/websocket/client.scm b/8sync/systems/websocket/client.scm index 9f2b0f0..a637384 100644 --- a/8sync/systems/websocket/client.scm +++ b/8sync/systems/websocket/client.scm @@ -313,9 +313,14 @@ KEY." (define (open-entropy-port) "Return an open input port to a reliable source of entropy for the current system." - ;; XXX: This works on GNU/Linux and OS X systems, but this isn't - ;; exactly portable. - (open-input-file "/dev/urandom")) + (if (file-exists? "/dev/urandom") + (open-input-file "/dev/urandom") + ;; XXX: This works as a fall back but this isn't exactly a + ;; reliable source of entropy. + (make-soft-port (vector (const #f) (const #f) (const #f) + (lambda _ (let ((r (random 256))) (integer->char r))) + (const #f) + (const #t)) "r"))) (define-method (websocket-close (websocket )) "Close the WebSocket connection for the client WEBSOCKET."