Overview
Comment: | wip, getting closer to tcp6 based approach working |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.6584-tcp6 |
Files: | files | file ages | folders |
SHA1: |
0dbc0e622558456a197658abb4fc0fd5 |
User & Date: | matt on 2021-06-01 05:43:13 |
Other Links: | branch diff | manifest | tags |
Context
2021-06-01
| ||
08:40 | wip check-in: fba10f42b6 user: matt tags: v1.6584-tcp6 | |
05:43 | wip, getting closer to tcp6 based approach working check-in: 0dbc0e6225 user: matt tags: v1.6584-tcp6 | |
2021-05-29
| ||
05:15 | wip check-in: 8e59940d89 user: matt tags: v1.6584-tcp6 | |
Changes
Modified apimod.scm from [43bf5f787b] to [bcadf5a9f5].
︙ | ︙ | |||
401 402 403 404 405 406 407 | ;; http-server send-response ;; api:process-request ;; db:* ;; ;; NB// Runs on the server as part of the server loop ;; | | | | | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | ;; http-server send-response ;; api:process-request ;; db:* ;; ;; NB// Runs on the server as part of the server loop ;; (define (api:process-request dbstruct indat) ;; the $ is the request vars proc (debug:print 0 *default-log-port* "server-id:" *server-id*) (let* ((cmd-in (alist-ref 'cmd indat)) ;; ($ 'cmd)) (cmd (if (string? cmd-in)(string->symbol cmd-in) cmd-in)) (params (string->sexpr (alist-ref 'params indat))) (key (alist-ref 'key indat)) ;; TODO - add this back ) (debug:print 0 *default-log-port* "cmd:" cmd " with params " params "key " key) (if (equal? key "nokey") ;; *server-id*) ;; TODO - get real key involved (begin (set! *api-process-request-count* (+ *api-process-request-count* 1)) (let* ((res (api:execute-requests dbstruct cmd params))) (debug:print 0 *default-log-port* "res:" res) |
︙ | ︙ |
Modified commonmod.scm from [5348abd36a] to [47e2c99089].
︙ | ︙ | |||
3779 3780 3781 3782 3783 3784 3785 | (define (string->sexpr instr) (handle-exceptions exn (begin (debug:print 0 *default-log-port* "ERROR: string->sexpr bad input \""instr"\"") #f) (with-input-from-string instr | | | 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 | (define (string->sexpr instr) (handle-exceptions exn (begin (debug:print 0 *default-log-port* "ERROR: string->sexpr bad input \""instr"\"") #f) (with-input-from-string instr read))) ) |
Modified fullrununit.sh from [12bf13749e] to [e6c2056159].
1 2 3 4 5 | #!/bin/bash (killall mtest -v;sleep 1;killall mtest -v -9;rm -f tests/simplerun/.db/* tests/simplerun/logs/* tests/basicserver.log) & ck5 make -j install && wait && | | | 1 2 3 4 5 6 | #!/bin/bash (killall mtest -v;sleep 1;killall mtest -v -9;rm -f tests/simplerun/.db/* tests/simplerun/logs/* tests/basicserver.log) & ck5 make -j install && wait && script -c "ck5 make unit" |
Modified rmtmod.scm from [df6ad4612b] to [3c6fe3273a].
︙ | ︙ | |||
49 50 51 52 53 54 55 | chicken.port chicken.pretty-print chicken.process chicken.process-context chicken.process-context.posix chicken.sort chicken.string | > | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | chicken.port chicken.pretty-print chicken.process chicken.process-context chicken.process-context.posix chicken.sort chicken.string ;; chicken.tcp chicken.random chicken.time chicken.time.posix (prefix sqlite3 sqlite3:) directory-utils ;; http-client ;; intarweb |
︙ | ︙ | |||
270 271 272 273 274 275 276 | (conns *rmt:remote*) (dbname (db:run-id->dbname rid))) (rmt:general-open-connection conns apath dbname) (rmt:send-receive-real conns apath dbname cmd params))) (define (rmt:send-receive-setup conn) (if (not (rmt:conn-inport conn)) | | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | (conns *rmt:remote*) (dbname (db:run-id->dbname rid))) (rmt:general-open-connection conns apath dbname) (rmt:send-receive-real conns apath dbname cmd params))) (define (rmt:send-receive-setup conn) (if (not (rmt:conn-inport conn)) (let-values (((i o) (tcp-connect (rmt:conn-ipaddr conn) (rmt:conn-port conn)))) (rmt:conn-inport-set! conn i) (rmt:conn-outport-set! conn o)))) ;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed ;; sometime in the future ;; (define (rmt:send-receive-real remote apath dbname cmd params) |
︙ | ︙ | |||
294 295 296 297 298 299 300 301 302 303 304 305 306 307 | (write payload (rmt:conn-outport conn)) (with-input-from-port (rmt:conn-inport conn) read-string)))) (if (string? res) (string->sexpr res) res)))) ;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed ;; sometime in the future. ;; ;; Purpose - call the main.db server and request a server be started ;; for the given area path and dbname ;; | > > | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | (write payload (rmt:conn-outport conn)) (with-input-from-port (rmt:conn-inport conn) read-string)))) (if (string? res) (string->sexpr res) res)))) ;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed ;; sometime in the future. ;; ;; Purpose - call the main.db server and request a server be started ;; for the given area path and dbname ;; |
︙ | ︙ | |||
1808 1809 1810 1811 1812 1813 1814 | all-pkt-files))) (define (server-address srv-pkt) (conc (alist-ref 'host srv-pkt) ":" (alist-ref 'port srv-pkt))) (define (server-ready? host port key) ;; server-address is host:port | | > | | > > | | > | < < | > > | | > | | | | < < < | 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 | all-pkt-files))) (define (server-address srv-pkt) (conc (alist-ref 'host srv-pkt) ":" (alist-ref 'port srv-pkt))) (define (server-ready? host port key) ;; server-address is host:port (let-values (((i o)(handle-exceptions exn (values #f #f) (tcp-connect host port)))) (if (and i o) (begin (write `((cmd . ping) (key . ,key) (params . ())) o) (let ((res (with-input-from-port i read))) (close-output-port o) (close-input-port i) (if (string? res) (string->sexpr res) res))) (begin ;; connection failed (debug:print-info 0 *default-log-port* "Server at "host":"port" is not responding.") #f)))) (define (loop-test host port data) ;; server-address is host:port ;; ping the server and ask it ;; if it ready ;; (let* ((sdat (servdat-init #f host port #f))) ;; (http-transport:send-receive sdat "abc" 'ping '()))) #;(let* ((payload (sexpr->string data)) (res (with-input-from-request |
︙ | ︙ |
Modified tests/unittests/basicserver.scm from [fc6484b63a] to [a2f1479995].
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ;; Run like this: ;; ;; ./rununittest.sh server 1;(cd simplerun;megatest -stop-server 0) (import rmtmod trace http-client apimod dbmod launchmod) (trace-call-sites #t) (trace ;; db:get-dbdat ;; rmt:find-main-server rmt:send-receive-real rmt:send-receive ;; sexpr->string ;; server-ready? ;; rmt:register-server ;; rmt:open-main-connection rmt:general-open-connection ;; rmt:get-conny ;; common:watchdog ;; rmt:find-main-server ;; get-all-server-pkts ;; get-viable-servers ;; get-best-candidate | > | > > | 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 | ;; Run like this: ;; ;; ./rununittest.sh server 1;(cd simplerun;megatest -stop-server 0) (import rmtmod trace http-client apimod dbmod launchmod) (trace-call-sites #t) (trace ;; db:get-dbdat ;; rmt:find-main-server rmt:send-receive-real rmt:send-receive ;; sexpr->string ;; server-ready? ;; rmt:register-server ;; rmt:open-main-connection rmt:general-open-connection ;; rmt:get-conny ;; common:watchdog ;; rmt:find-main-server ;; get-all-server-pkts ;; get-viable-servers ;; get-best-candidate api:run-server-process rmt:run rmt:try-start-server ) (test #f #t (rmt:remote? (let ((r (make-rmt:remote))) (set! *rmt:remote* r) r))) (test #f #f (rmt:get-conn *rmt:remote* *toppath* ".db/main.db")) (test #f #f (rmt:find-main-server *toppath* ".db/main.db")) |
︙ | ︙ | |||
68 69 70 71 72 73 74 75 76 77 78 79 80 81 | (define apath *toppath*) (define dbname ".db/2.db") (define remote *rmt:remote*) (define keyvals '(("SYSTEM" "a")("RELEASE" "b"))) (test #f 'server-started (api:execute-requests *db* 'get-server (list *toppath* ".db/2.db"))) (set! *dbstruct-db* #f) (test #f #t (rmt:open-main-connection remote apath)) (test #f #t (rmt:conn? (rmt:get-conn *rmt:remote* *toppath* ".db/main.db"))) (test #f 'server-started (rmt:send-receive-real *rmt:remote* *toppath* ".db/main.db" 'get-server `(,apath ,dbname))) (thread-sleep! 2) (test #f #t (list? (rmt:general-open-connection *rmt:remote* *toppath* ".db/2.db"))) | > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | (define apath *toppath*) (define dbname ".db/2.db") (define remote *rmt:remote*) (define keyvals '(("SYSTEM" "a")("RELEASE" "b"))) (test #f 'server-started (api:execute-requests *db* 'get-server (list *toppath* ".db/2.db"))) (set! *dbstruct-db* #f) (exit) (test #f #t (rmt:open-main-connection remote apath)) (test #f #t (rmt:conn? (rmt:get-conn *rmt:remote* *toppath* ".db/main.db"))) (test #f 'server-started (rmt:send-receive-real *rmt:remote* *toppath* ".db/main.db" 'get-server `(,apath ,dbname))) (thread-sleep! 2) (test #f #t (list? (rmt:general-open-connection *rmt:remote* *toppath* ".db/2.db"))) |
︙ | ︙ |