Megatest

Diff
Login

Differences From Artifact [9af81f0275]:

To Artifact [9d27b5b698]:


67
68
69
70
71
72
73

74


75
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
67
68
69
70
71
72
73
74

75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92







+
-
+
+








-
+







	  (udat-captain-port-set!    udata port)
	  (udat-captain-pid-set!     udata pid)
	  (if (ping udata (conc ipaddr ":" port))
	      udata
	      (begin
		(remove-captain-pkt udata captn)
		(setup))))
	(begin
	(setup-as-captain udata)) ;; this saves the thread to captain-thread and starts the thread
	  (setup-as-captain udata)  ;; this saves the thread to captain-thread and starts the thread
	  (setup)))
    ))

;; connect to a specific dbfile
(define (connect udata dbfname dbtype)
  udata)

(define (ping udata host-port)
  (let ((cookie (make-cookie udata)))
    (send udata host-port 'ping "just pinging" (current-seconds))
    (send udata host-port 'ping "just pinging" (conc (current-seconds)))
    ;; (mailbox-rec
    ))

;;======================================================================
;; network utilities
;;======================================================================

426
427
428
429
430
431
432
433
434


435
436
437
438
439
440
441
428
429
430
431
432
433
434


435
436
437
438
439
440
441
442
443







-
-
+
+







		  (send udata host:port "version" qrykey val)))
	       ((rucaptain)
		(send udata host:port "iamcaptain" qrykey (if (udat-my-cpkt-key udata)
							      "yes"
							      "no")))
	       (else
		;; (send-ack udata host:port qrykey)
		(add-to-work-queue udata (get-peer-dat udata host:port) handlerkey qrykey data)))
	     (else (print "BAD DATA? handler=" handlerkey " data=" data)))))
		(add-to-work-queue udata (get-peer-dat udata host:port) handlerkey qrykey data))))
	    (else (print "BAD DATA? controldat=" controldat " data=" data))))
	(loop state)))))

;; add a proc to the handler list
(define (register-handler udata key proc)
  (hash-table-set! (udat-handlers udata) key proc))