X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=8sync%2Fsystems%2Fwebsocket%2Fclient.scm;fp=8sync%2Fsystems%2Fwebsocket%2Fclient.scm;h=4ae342d9c919f776b8ff3498ffff23999e79458b;hb=c45e4b2baeb7500002ad8a7c77ef76f86851d321;hp=107aea96e0283ae673839cd333a58b2ade388f5b;hpb=cb81d74e04a73cd208a7768c5d913ca4728a0ece;p=8sync.git diff --git a/8sync/systems/websocket/client.scm b/8sync/systems/websocket/client.scm index 107aea9..4ae342d 100644 --- a/8sync/systems/websocket/client.scm +++ b/8sync/systems/websocket/client.scm @@ -308,9 +308,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."