From aaa3cccd898b3e3cd2a88130bab1399ae19ba829 Mon Sep 17 00:00:00 2001 From: Greg Cooper Date: Sun, 18 Jun 2006 18:18:35 +0000 Subject: [PATCH] - disabled creation of tcp listener in erl.ss, which caused infinite loop on machines with networking completely turned off - added find-listener/port, which may be used in the future to enable networking explicitly (though erl.ss will need significant mods for that) - removed mention of distribution in README for demos (i.e., net-pong demo) - minor bug fix in gui wrapper - noted that spreadsheet is broken on MacOS svn: r3403 --- collects/frtime/demos/README | 30 ----------------------- collects/frtime/demos/gui/fred.ss | 3 ++- collects/frtime/demos/spreadsheet/doc.txt | 1 + collects/frtime/erl.ss | 17 +++++++++---- 4 files changed, 15 insertions(+), 36 deletions(-) diff --git a/collects/frtime/demos/README b/collects/frtime/demos/README index 2f34aa47cd..7ae9d5a0da 100644 --- a/collects/frtime/demos/README +++ b/collects/frtime/demos/README @@ -21,36 +21,6 @@ pong.ss : A simple pong/air-hockey game. The left paddle moves with numeric keypad; the right paddle moves with the mouse. The 'r' key resets the score. -net-pong-*.ss : A networked version of the pong/air-hockey game. -Currently known to work under Linux. To play, open the client on one -machine and the server on another. Execute both (and require if -necessary, depending on language level). Evaluate (self) on each. -Results will be something like: - -[client] -> (self) -#3(tid 128.148.38.2:1180 main) - -and -[server] -> (self) -#3(tid 128.148.33.71:1178 main) - -Now tell each machine about the other: -[client] -> (set-cell! server (make-tid '128.148.33.71 1178 'frtime-heart)) - -[server] -> (set-cell! client (make-tid '128.148.38.2 1180 'frtime-heart)) - -Note the differences between the #3(tid ...) output and the (make-tid ...) -commands---there is no colon (:) between the host and port, and main becomes -'frtime-heart. - -After setting the cells, complete the connection by clicking the left -mouse button in both animation windows. The player running the server -can reset the score by pressing 'r'. - pizza.ss : A simple "pizza ordering" user interface based on an HtDP exercise. diff --git a/collects/frtime/demos/gui/fred.ss b/collects/frtime/demos/gui/fred.ss index 97c136882b..f7b63d595e 100644 --- a/collects/frtime/demos/gui/fred.ss +++ b/collects/frtime/demos/gui/fred.ss @@ -230,7 +230,8 @@ (add-signal-controls (class gauge% (init value) - (super-new)) + (super-new) + (send this set-value value)) (value set-value 0) (range set-range 1))) diff --git a/collects/frtime/demos/spreadsheet/doc.txt b/collects/frtime/demos/spreadsheet/doc.txt index 2b7abb6946..70f042c4af 100644 --- a/collects/frtime/demos/spreadsheet/doc.txt +++ b/collects/frtime/demos/spreadsheet/doc.txt @@ -29,3 +29,4 @@ Known Bugs: - Whole-screen redraw, as when scrolling or resizing, is super slow. - Errors arising during re-evaluation (not during initial evaluation) go to the DrScheme interactions window instead of propagating to the cell. +- Does not work on MacOS diff --git a/collects/frtime/erl.ss b/collects/frtime/erl.ss index db165dff21..66fccc71c2 100644 --- a/collects/frtime/erl.ss +++ b/collects/frtime/erl.ss @@ -41,11 +41,18 @@ ; for thread ids, port is the TCP port number (not to be confused with MzScheme ports) (define-values (listener port) - ; find first free port after 1178 - (let loop ([port 1178]) - (with-handlers - ([exn:fail:network? (lambda (_) (loop (add1 port)))]) - (values (tcp-listen port) port)))) + ; for the time being, disable distribution + (values never-evt 1178)) + + (define (find-listener/port num-retries) + (parameterize ([current-pseudo-random-generator (make-pseudo-random-generator)]) + (let loop ([i 0]) + (with-handlers* ([(lambda (exn) + (and (exn:fail:network? exn) + (< i num-retries))) + (lambda (_) (loop (add1 i)))]) + (let ([port (+ 1024 (random 64000))]) + (values (tcp-listen port) port)))))) (define ip-address '127.0.0.1 #;(let*-values