sleep delay interval setting now managed as a global variable
This commit is contained in:
parent
9e1f8c33d1
commit
7e7edb4a54
@ -15,6 +15,7 @@
|
||||
(define host2 "67.186.191.81")
|
||||
(define host3 "localhost")
|
||||
(define port-num 4321)
|
||||
(define sleep-t 0.1)
|
||||
|
||||
; we won't need this. Just me being overzealous
|
||||
(define hermes-conf (open-output-file "./hermes_client.conf" #:exists'append))
|
||||
@ -49,14 +50,14 @@
|
||||
(displayln-safe "Starting receiver thread." error-out-s error-out)
|
||||
(let loop []
|
||||
(receive-messages in)
|
||||
(sleep 1)
|
||||
(sleep sleep-t)
|
||||
(loop)))))
|
||||
(define t (thread
|
||||
(lambda ()
|
||||
(displayln-safe "Starting sender thread." error-out-s error-out)
|
||||
(let loop []
|
||||
(send-messages username out)
|
||||
(sleep 1)
|
||||
(sleep sleep-t)
|
||||
(loop)))))
|
||||
(displayln-safe "Now waiting for sender thread." error-out-s error-out)
|
||||
(thread-wait t) ;; returns prompt back to drracket
|
||||
|
@ -4,10 +4,11 @@
|
||||
(require math/base) ;; for random number generation
|
||||
|
||||
|
||||
;; globals
|
||||
(define welcome-message "Welcome to Hermes coms. Type your message below")
|
||||
(define successful-connection-m "Successfully connected to a client. Sending client a welcome message.")
|
||||
|
||||
(define sleep-t 0.1)
|
||||
|
||||
; track number of connections with closure
|
||||
(define (make-count no-count)
|
||||
(define (increment)
|
||||
@ -95,7 +96,7 @@
|
||||
(thread (lambda ()
|
||||
(displayln-safe "Broadcast thread started!\n")
|
||||
(let loopb []
|
||||
(sleep 0.5) ;; wait 0.5 secs before beginning to broadcast
|
||||
(sleep sleep-t) ;; wait 0.5 secs before beginning to broadcast
|
||||
(broadcast)
|
||||
(loopb)))))
|
||||
(lambda ()
|
||||
|
Loading…
Reference in New Issue
Block a user