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: |
cc86d81234b044d9e83c2f3a3411d03a |
User & Date: | matt on 2020-01-05 20:51:13 |
Other Links: | branch diff | manifest | tags |
Context
2020-01-05
| ||
22:53 | wip check-in: cb68d1b734 user: matt tags: v1.70-captain-ulex, v1.70-defunct-try | |
20:51 | wip check-in: cc86d81234 user: matt tags: v1.70-captain-ulex, v1.70-defunct-try | |
2020-01-04
| ||
16:45 | Pulled in compilation fixes from refactor02. check-in: 337a4b27f1 user: matt tags: v1.70-captain-ulex, v1.70-defunct-try | |
Changes
Modified ulex/ulex.scm from [63bf7783f2] to [91a15a4ec1].
︙ | ︙ | |||
103 104 105 106 107 108 109 110 111 112 113 114 115 116 | ;; struct for keeping track of our world (defstruct udat (captain-address #f) (captain-host #f) (captain-port #f) (captain-pid #f) (cpkts-dir (conc (get-environment-variable "HOME") "/.ulex/pkts")) (cpkt-spec *captain-pktspec*) (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)) | > | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | ;; struct for keeping track of our world (defstruct udat (captain-address #f) (captain-host #f) (captain-port #f) (captain-pid #f) (ulex-dir (conc (get-environment-variable "HOME") "/.ulex")) (cpkts-dir (conc (get-environment-variable "HOME") "/.ulex/pkts")) (cpkt-spec *captain-pktspec*) (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)) |
︙ | ︙ | |||
295 296 297 298 299 300 301 302 303 304 305 306 307 308 | (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 ;; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | (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)) ;;====================================================================== ;; Ulex db ;;====================================================================== ;; dest='inmem or 'disk ;; (define (open-ulexdb udata dest) (let* ((dbfile (conc (udat-ulex-dir udata) "/ulex.db")) (dbexists (file-exists? dbfile)) (db (sqlite3:open-database dbfile))) (sqlite3:set-busy-handler! db (sqlite3:make-busy-timeout 136000)) (if (not dbexists) (sqlite3:with-transaction db (lambda () (for-each (lambda (stmt) (if stmt (sqlite3:execute db stmt))) `("CREATE TABLE IF NOT EXISTS processes (id INTEGER PRIMARY KEY, host TEXT NOT NULL, ipadr TEXT NOT NULL, port INTEGER NOT NULL, pid INTEGER NOT NULL, regtime INTEGER DEFAULT (strftime('%s','now')), last_update INTEGER DEFAULT (strftime('%s','now')));" (if (eq? dest 'inmem) "CREATE TRIGGER IF NOT EXISTS update_proces_trigger AFTER UPDATE ON processes FOR EACH ROW BEGIN UPDATE processes SET last_update=(strftime('%s','now')) WHERE id=old.id; END;" #f)))))) db)) ;;====================================================================== ;; connection setup and management functions ;;====================================================================== ;; find or become the captain, return a ulex object ;; |
︙ | ︙ |