Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v2.0001 |
Files: | files | file ages | folders |
SHA1: |
db564d80d978cd9f33a08bcd3590b0d7 |
User & Date: | matt on 2022-01-03 09:34:30 |
Other Links: | branch diff | manifest | tags |
Context
2022-01-03
| ||
12:01 | main.db and <run>.db servers working with ulex check-in: 2f2d804be0 user: matt tags: v2.0001 | |
09:34 | wip check-in: db564d80d9 user: matt tags: v2.0001 | |
2022-01-02
| ||
20:49 | wip check-in: 844a9d0924 user: matt tags: v2.0001 | |
Changes
Added ulex/Makefile version [1659f80ce4].
> > > > > > > > > | 1 2 3 4 5 6 7 8 9 | all : ulex.pdf ulex.png ulex.pdf : ulex.dot dot -Tpdf ulex.dot -o ulex.pdf ulex.png : ulex.dot dot -Tpng ulex.dot -o ulex.png |
Added ulex/ulex.dot version [08f8e06c6d].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | // Copyright 2006-2017, Matthew Welland. // // This file is part of Megatest. // // Megatest is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Megatest is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Megatest. If not, see <http://www.gnu.org/licenses/>. digraph G { // graph[center=true, margin=0.2, nodesep=0.1, ranksep=0.3] layout=neato; // layout=fdp; // overlap=scalexy; //false, compress, ... overlap=scalexy; // sep="+1"; // 0.1, +1 sep="-0.1"; user_program [label="user program"]; subgraph cluster_1 { node [style=filled,shape=oval]; label = "caller"; color=brown; send_receive [label="(send-receive uconn\n host-port qrykey cmd data)"]; send [label="(send uconn host-port\n qrykey cmd data)"]; ulex_cmd_loopcaller [label="(ulex-cmd-loop uconn)"]; ulex_handlercaller [label="(ulex-handler uconn rdat)"]; mailbox [label="mailbox\n\nrdat\n...",shape=box]; send_receive -> send; ulex_cmd_loopcaller -> ulex_handlercaller; ulex_handlercaller -> mailbox; mailbox -> send_receive; } subgraph cluster_2 { node [shape=oval]; label = "listener"; color=green; ulex_cmd_loop [label="(ulex-cmd-loop uconn)"]; ulex_handler [label="(ulex-handler \nuconn rdat)"]; add_to_work_queue [label="(add-to-work-queue\n uconn rdat)"]; queue [label="queue\n\nrdat\n...",shape=box]; process_work_queue [label="(process-work-queue uconn)"]; do_work [label="(do-work uconn rdat)\nrdat: '(rem-host-port qrykey cmd params)"]; user_proc [label="(proc rem-host-port\n qrykey cmd params)\n;; proc supplied by user"]; sendlis [label="(send uconn host-port\n qrykey 'response result)"]; ulex_cmd_loop -> ulex_handler [label="rdat"]; ulex_handler -> add_to_work_queue [label="rdat"]; add_to_work_queue -> queue [label="rdat"]; subgraph cluster_3 { label = "remote work"; color=blue; queue -> process_work_queue [label="rdat"]; process_work_queue -> do_work [label="rdat"]; do_work -> user_proc; // [label="rdat: '(rem-host-port\n qrykey cmd params)"]; } } user_proc -> sendlis; user_program -> send_receive; send_receive -> user_program; send -> ulex_cmd_loop [label="rdat: '(host-port\n qrykey cmd data)"]; sendlis -> ulex_cmd_loopcaller [label="rdat: '(host-port qrykey\n 'response result)"]; ulex_handler -> send [label="'ack"]; ulex_handlercaller -> sendlis [label="'ack"]; } // check_available_queue -> remove_entries_over_10s_old; // remove_entries_over_10s_old -> set_available [label="num_avail < 3"]; // remove_entries_over_10s_old -> exit [label="num_avail > 2"]; // // set_available -> delay_2s; // delay_2s -> check_place_in_queue; // // check_place_in_queue -> "http:transport-launch" [label="at head"]; // check_place_in_queue -> exit [label="not at head"]; // // "client:login" -> "server:shutdown" [label="login failed"]; // "server:shutdown" -> exit; // // subgraph cluster_2 { // "http:transport-launch" -> "http:transport-run"; // "http:transport-launch" -> "http:transport-keep-running"; // // "http:transport-keep-running" -> "tests running?"; // "tests running?" -> "client:login" [label=yes]; // "tests running?" -> "server:shutdown" [label=no]; // "client:login" -> delay_5s [label="login ok"]; // delay_5s -> "http:transport-keep-running"; // } // // start_server -> "server_running?"; // "server_running?" -> set_available [label="no"]; // "server_running?" -> delay_2s [label="yes"]; // delay_2s -> "still_running?"; // "still_running?" -> ping_server [label=yes]; // "still_running?" -> set_available [label=no]; // ping_server -> exit [label=alive]; // ping_server -> remove_server_record [label=dead]; // remove_server_record -> set_available; // set_available -> avail_delay [label="delay 3s"]; // avail_delay -> "first_in_queue?"; // // "first_in_queue?" -> set_running [label=yes]; // set_running -> get_next_port -> handle_requests; // "first_in_queue?" -> "dead_entry_in_queue?" [label=no]; // "dead_entry_in_queue?" -> "server_running?" [label=no]; // "dead_entry_in_queue?" -> "remove_dead_entries" [label=yes]; // remove_dead_entries -> "server_running?"; // // handle_requests -> start_shutdown [label="no traffic\nno running tests"]; // handle_requests -> shutdown_request; // start_shutdown -> shutdown_delay; // shutdown_request -> shutdown_delay; // shutdown_delay -> exit; |
Added ulex/ulex.pdf version [a11f1937d3].
cannot compute difference between binary files
Added ulex/ulex.png version [1ca21b08ef].
cannot compute difference between binary files
Modified ulex/ulex.scm from [afccb56e89] to [d58d57adb7].
︙ | ︙ | |||
228 229 230 231 232 233 234 | (print "ERROR: Communication failed?") #f)))) ;; #f means failed to communicate ;;====================================================================== ;; responder side ;;====================================================================== | | | | | | | | | | | | | | | | | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 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 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | (print "ERROR: Communication failed?") #f)))) ;; #f means failed to communicate ;;====================================================================== ;; responder side ;;====================================================================== ;; take a request, rdat, and if not immediate put it in the work queue ;; ;; Reserved cmds; ack ping goodbye response ;; (define (ulex-handler uconn rdat) (match rdat ;; (string-split controldat) ((rem-host-port qrykey cmd params) ;; (print "ulex-handler got: "rem-host-port" qrykey: "qrykey" cmd: "cmd" params: "params) (let ((mbox (hash-table-ref/default (udat-mboxes uconn) qrykey #f))) (case cmd ;; ((ack )(print "Got ack! But why? Should NOT get here.") 'ack) ((ping) ;; (print "Got Ping!") (add-to-work-queue uconn rdat) 'ack) ((goodbye) ;; just clear out references to the caller (add-to-work-queue uconn rdat) 'ack) ((response) ;; this is a result from remote processing, send it as mail ... (if mbox (begin (mailbox-send! mbox params) ;; params here is our result 'ack) (begin (print "ERROR: received result but no associated mbox for cookie "qrykey) #f))) (else ;; (print "Got generic request: "cmd) (add-to-work-queue uconn rdat) 'ack)))) (else (print "BAD DATA? controldat=" rdat) 'ack) ;; send ack anyway? )) ;; given an already set up uconn start the cmd-loop ;; (define (ulex-cmd-loop uconn) (let* ((serv-listener (udat-socket uconn))) (let loop ((state 'start)) (let-values (((inp oup)(tcp-accept serv-listener))) (let* ((rdat (read inp)) ;; '(my-host-port qrykey cmd params) (resp (ulex-handler uconn rdat))) (if resp (write resp oup)) (close-input-port inp) (close-output-port oup)) (loop state))))) ;; add a proc to the cmd list, these are done symetrically (i.e. in all instances) ;; so that the proc can be dereferenced remotely ;; (define (set-work-handler uconn proc) (udat-work-proc-set! uconn proc)) ;;====================================================================== ;; work queues - this is all happening on the listener side ;;====================================================================== ;; rdat is (rem-host-port qrykey cmd params) (define (add-to-work-queue uconn rdat) (queue-add! (udat-work-queue uconn) rdat)) (define (do-work uconn rdat) (let* ((proc (udat-work-proc uconn))) ;; get it each time - conceivebly it could change ;; put this following into a do-work procedure (match rdat ((rem-host-port qrykey cmd params) (let* ((result (proc rem-host-port qrykey cmd params))) ;; send 'response as cmd and result as params (send uconn rem-host-port qrykey 'response result))) ;; could check for ack (else (print "ERROR: rdat "rdat", did not match rem-host-port qrykey cmd params"))))) (define (process-work-queue uconn) (let ((wqueue (udat-work-queue uconn)) (proc (udat-work-proc uconn))) (let loop () (if (queue-empty? wqueue) (thread-sleep! 0.1) (let ((rdat (queue-remove! wqueue))) (do-work uconn rdat))) (loop)))) ;; below was to enable re-use of connections. This seems non-trivial so for ;; now lets open on each call ;; ;; ;; given host-port get or create peer struct ;; ;; |
︙ | ︙ |