61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
-
-
+
+
|
(equal? (substring msg-in 0 4) "ping"))
(nn-send soc (conc (current-process-id)))
(loop (nn-recv soc)(+ count 1)))
(else
(mutex-lock! *current-delay-mutex*)
(let ((current-delay *current-delay*))
(mutex-unlock! *current-delay-mutex*)
(thread-sleep! current-delay)
(nn-send soc (conc "hello " msg-in " you waited " current-delay " seconds"))
;; (thread-sleep! current-delay)
(nn-send soc (conc current-delay " hello " msg-in " you waited " current-delay " seconds"))
(loop (nn-recv soc)(if (> count 20000000)
0
(+ count 1))))))))
(define (ping-self host port #!key (return-socket #t))
;; send a random number along with pid and check that we get it back
(let* ((req (nn-socket 'req))
|