aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIbrahim Mkusa <ibrahimmkusa@gmail.com>2017-04-16 17:20:17 -0400
committerIbrahim Mkusa <ibrahimmkusa@gmail.com>2017-04-16 17:20:17 -0400
commit7e7edb4a54d18d7ee75a228b7f2209d99827449f (patch)
tree20a89073b56f4c312246b08d035644226e8891a3
parent9e1f8c33d17189c6bdf4c4db9481c0c08ee12218 (diff)
sleep delay interval setting now managed as a global variable
-rw-r--r--Hermes/client.rkt5
-rw-r--r--Hermes/server.rkt5
2 files changed, 6 insertions, 4 deletions
diff --git a/Hermes/client.rkt b/Hermes/client.rkt
index c328095..e50a37f 100644
--- a/Hermes/client.rkt
+++ b/Hermes/client.rkt
@@ -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
diff --git a/Hermes/server.rkt b/Hermes/server.rkt
index 6314f3b..ee949f5 100644
--- a/Hermes/server.rkt
+++ b/Hermes/server.rkt
@@ -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 ()