Megatest

Diff
Login

Differences From Artifact [8950d17727]:

To Artifact [dc86555194]:


31
32
33
34
35
36
37

38
39
40
41








42
43
44
45
46
47
48
49
50
51
52
53

54








55

56



57
58
(module clientmod
*

(import scheme
	posix
	data-structures
	srfi-18


	artifacts
	servermod
	)









(define (client:find-server areapath)
  (let* ((sdir  (conc areapath"/.server"))
	 (sarfs (glob (conc sdir"/*.artifact")))) ;; server artifacts
    (if (null? sarfs)
	(begin
	  (server:launch areapath)
	  (thread-sleep! 1)
	  (client:find-server areapath))
	(let* ((sarf (car sarfs))
	       (sdat (read-artifact->alist sarf))
	       (srvdir (alist-ref 'd sdat)))

	  srvdir))))








	  

	  



)








>




>
>
>
>
>
>
>
>











|
>
|
>
>
>
>
>
>
>
>
|
>
|
>
>
>


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
(module clientmod
*

(import scheme
	posix
	data-structures
	srfi-18
	typed-records

	artifacts
	servermod
	)

(defstruct con ;; client connection
  (hdir       #f)
  (obj-to-str #f)
  (host       #f)
  (pid        #f)
  (sdat       #f) ;; server artifact data
  )

(define (client:find-server areapath)
  (let* ((sdir  (conc areapath"/.server"))
	 (sarfs (glob (conc sdir"/*.artifact")))) ;; server artifacts
    (if (null? sarfs)
	(begin
	  (server:launch areapath)
	  (thread-sleep! 1)
	  (client:find-server areapath))
	(let* ((sarf (car sarfs))
	       (sdat (read-artifact->alist sarf))
	       (hdir (alist-ref 'd sdat)))
	  (make-con hdir: hdir sdat: sdat)))))

(define (client:send-receive con cmd params)
  (let* ((obj->string (con-obj-to-str con))
	 (arf  `((c . ,cmd)
		 (p . ,(obj->string params))
		 (h . ,(con-host con))
		 (i . ,(con-pid  con))))
	 (hdir  (con-hdir con))
	 (uuid  (write-alist->artifact hdir arf ptype: 'Q)))
    
    ;; wait for a response here

    #f
    ))

)