Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.70-captain-ulex | v1.70-defunct-try |
Files: | files | file ages | folders |
SHA1: |
b95526b7f3d4fdbb8deac365d4b35e33 |
User & Date: | matt on 2020-01-02 21:39:10 |
Other Links: | branch diff | manifest | tags |
Context
2020-01-04
| ||
16:36 | Initial sysmon stuff check-in: e4bc65a729 user: matt tags: v1.70-captain-ulex, v1.70-defunct-try | |
2020-01-02
| ||
21:39 | wip check-in: b95526b7f3 user: matt tags: v1.70-captain-ulex, v1.70-defunct-try | |
19:48 | wip check-in: ad7092727d user: mrwellan tags: v1.70-captain-ulex, v1.70-defunct-try | |
Changes
Modified rmtmod.scm from [5550ea1678] to [5c3bd41b91].
︙ | ︙ | |||
77 78 79 80 81 82 83 | ;; - finds the "captain" and asks who to talk to for the given dbfname ;; - establishes the connection to the current dbowner ;; (define (rmt:connect alldat dbfname) (let* ((ulexdat (let ((uconn (alldat-ulexdat alldat))) (if uconn uconn | | > > > > > > > | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | ;; - finds the "captain" and asks who to talk to for the given dbfname ;; - establishes the connection to the current dbowner ;; (define (rmt:connect alldat dbfname) (let* ((ulexdat (let ((uconn (alldat-ulexdat alldat))) (if uconn uconn (let* ((new-ulexdat (ulex:setup))) ;; establish connection to ulex (alldat-ulexdat-set! alldat new-ulexdat) (rmt:setup-ulex alldat) new-ulexdat))))) (ulex:connect ulexdat dbfname))) ;; set up a connection to the current owner of the dbfile associated with rid ;; then send the query to that dbfile owner and wait for a response. ;; (define (rmt:send-receive cmd rid params #!key (attemptnum 1)(area-dat #f)) ;; start attemptnum at 1 so the modulo below works as expected (let* ((alldat *alldat*) (areapath (alldat-areapath alldat)) (dbfname (if (or (not rid)(< rid 1)) ;; this is the criteria for "main.db" "main.db" (conc rid ".db"))) (dbfile (conc areapath "/.db/" dbfname)) (ulexconn (rmt:connect alldat dbfname))) (rmt:open-qry-close-locally cmd 0 params))) ;; setup the remote calls (define (rmt:setup-ulex alldat) (let ((udata (alldat-ulexdat alldat))) (ulex:register-handler udata 'ping common:get-full-version) )) ;; ;; ;; #;(common:telemetry-log (conc "rmt:"(->string cmd)) ;; ;; #;(define (rmt:send-receive cmd rid params #!key (attemptnum 1)(area-dat #f)) ;; start attemptnum at 1 so the modulo below works as expected ;; ;; ;; ;; #;(common:telemetry-log (conc "rmt:"(->string cmd)) ;; ;; payload: `((rid . ,rid) ;; ;; (params . ,params))) |
︙ | ︙ |
Modified ulex/ulex.scm from [d39aeae93d] to [63bf7783f2].
︙ | ︙ | |||
112 113 114 115 116 117 118 | (my-cpkt-key #f) ;; put Z card here when I create a pkt for myself as captain (my-address #f) (my-hostname #f) (my-port #f) (my-pid (current-process-id)) (serv-listener #f) (handler-thread #f) | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | (my-cpkt-key #f) ;; put Z card here when I create a pkt for myself as captain (my-address #f) (my-hostname #f) (my-port #f) (my-pid (current-process-id)) (serv-listener #f) (handler-thread #f) (handlers (make-hash-table)) (outgoing-conns (make-hash-table)) ;; host:port -> conn ) ;; struct for keeping track of others we are talking to (defstruct peer (addr-port #f) |
︙ | ︙ | |||
241 242 243 244 245 246 247 | npdat)))) pdat)) (define (get-peer-ports udata host-port #!optional (hostname #f)(pid #f)) (let ((pdat (get-peer-dat udata host-port hostname pid))) (values (peer-inp pdat)(peer-oup pdat)))) | | > | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | npdat)))) pdat)) (define (get-peer-ports udata host-port #!optional (hostname #f)(pid #f)) (let ((pdat (get-peer-dat udata host-port hostname pid))) (values (peer-inp pdat)(peer-oup pdat)))) ;; send back ack, amusing I suppose that this looks almost like what ;; tcp itself does ... ;; (define (reply udata host-port handler qrykey data #!optional (hostname #f)(pid #f)) (let-values (((inp oup)(get-peer-ports udata host-port hostname pid))) (write-line (conc handler " " (udat-my-address udata) ":" (udat-my-port udata) " " (udat-my-hostname udata) " " |
︙ | ︙ | |||
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | (let loop ((state 'start)) (let* ((controldat (read-line inp)) (data (read-line inp))) (match (string-split controldat) ((handlerkey host:port hostname pid qrykey params ...) (case (string->symbol handlerkey) ((ack)(print "Got ack!")) ((rucaptain) (reply udata host:port "iamcaptain" qrykey (if (udat-my-cpkt-key udata) "yes" "no"))) (else (send-ack udata host:port qrykey hostname pid) (add-to-work-queue udata (get-peer-dat udata host:port) handlerkey data))) (else (print "BAD DATA? handler=" handlerkey " data=" data))))) (loop state))))) ;;====================================================================== ;; connection setup and management functions ;;====================================================================== ;; find or become the captain, return a ulex object ;; (define (setup) | > > > > > > > > | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | (let loop ((state 'start)) (let* ((controldat (read-line inp)) (data (read-line inp))) (match (string-split controldat) ((handlerkey host:port hostname pid qrykey params ...) (case (string->symbol handlerkey) ((ack)(print "Got ack!")) ((ping) (let* ((proc (hash-table-ref/default (udat-handlers udata) 'ping #f)) (val (if proc (proc) "gotping"))) (reply udata host:port "version" qrykey val))) ((rucaptain) (reply udata host:port "iamcaptain" qrykey (if (udat-my-cpkt-key udata) "yes" "no"))) (else (send-ack udata host:port qrykey hostname pid) (add-to-work-queue udata (get-peer-dat udata host:port) handlerkey data))) (else (print "BAD DATA? handler=" handlerkey " 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)) ;;====================================================================== ;; connection setup and management functions ;;====================================================================== ;; find or become the captain, return a ulex object ;; (define (setup) |
︙ | ︙ |