X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;ds=sidebyside;f=sam.scm;fp=sam.scm;h=88ae320571b278c59e00879782f51518cecef13e;hb=d9768084b4cde1dd4ac4edcbb432b7df4101bfc2;hp=17c6f41b101187c5eeb054b5c62c268442feec32;hpb=882336f2f5d74856222f5be79ea4709481a2c602;p=sam.git diff --git a/sam.scm b/sam.scm index 17c6f41..88ae320 100644 --- a/sam.scm +++ b/sam.scm @@ -22,6 +22,7 @@ srfi-18 ; threads srfi-69 ; hash-table uuid ; ids for actors + uri-generic udp fifo) @@ -49,10 +50,16 @@ (define (address-port address) (caddr address)) (define (address->string address) - (with-output-to-string - (lambda () (write address)))) + (uri->string + (make-uri #:scheme "actor" + #:host (address-host address) + #:port (address-port address) + #:path (list '/ (address-id address))))) (define (string->address str) - (with-input-from-string str read)) + (let ((uri (uri-reference str))) + (make-address (uri-host uri) + (uri-port uri) + (cadr (uri-path uri))))) (define (address-local? address) (and (equal? (address-host address) sam-host) @@ -71,7 +78,8 @@ (let ((id (address-id address))) (let ((behaviour (hash-table-ref/default actor-table id '()))) (if (null? behaviour) - (print "Warning: discarded message" message " to unknown actor " address) + (print "Warning: discarded message " message + " to unknown actor id " id) (match (apply (hash-table-ref actor-table id) (cons address message)) ('done (hash-table-delete! actor-table id)) ('sleep 'do-nothing)