Use actor macro
This commit is contained in:
parent
ceef225fce
commit
b928d6c78a
|
@ -4,13 +4,8 @@
|
|||
|
||||
(spawn-udp-driver)
|
||||
|
||||
(spawn (lambda (e s)
|
||||
(match e
|
||||
[(message (udp-packet src dst body) _ _)
|
||||
(log-info "Got packet from ~v: ~v" src body)
|
||||
(transition s (send (udp-packet dst
|
||||
src
|
||||
(string->bytes/utf-8 (format "You said: ~a" body)))))]
|
||||
[_ #f]))
|
||||
(void)
|
||||
(gestalt-union (sub (udp-packet ? (udp-listener 5999) ?))))
|
||||
(actor #:name echoer
|
||||
(subscribe (udp-packet ($ src) ($ dst (udp-listener 5999)) ($ body))
|
||||
(log-info "Got packet from ~v: ~v" src body)
|
||||
(define reply (string->bytes/utf-8 (format "You said: ~a" body)))
|
||||
(send (udp-packet dst src reply))))
|
||||
|
|
Loading…
Reference in New Issue