Overview
Comment: | Speculatively removed inp and oup saving and close all ports |
---|---|
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: |
5263e9f2cef8e9c3dac4b197fe001f47 |
User & Date: | matt on 2020-01-20 03:01:19 |
Other Links: | branch diff | manifest | tags |
Context
2020-01-20
| ||
03:34 | Added drop captain send to all peers check-in: d20ee11c75 user: matt tags: v1.70-captain-ulex, v1.70-defunct-try | |
03:01 | Speculatively removed inp and oup saving and close all ports check-in: 5263e9f2ce user: matt tags: v1.70-captain-ulex, v1.70-defunct-try | |
2020-01-19
| ||
23:00 | Ulex ping and goodbye working check-in: 7d309a338c user: matt tags: v1.70-captain-ulex, v1.70-defunct-try | |
Changes
Modified ulex/ulex.scm from [bd67e74654] to [e8344f5ae3].
︙ | ︙ | |||
219 220 221 222 223 224 225 226 227 228 229 230 231 | #f)) (define (udat-captain-host-port udata) (if (and (udat-captain-address udata)(udat-captain-port udata)) (conc (udat-captain-address udata) ":" (udat-captain-port udata)) #f)) ;; struct for keeping track of others we are talking to (defstruct peer (addr-port #f) (hostname #f) (pid #f) | > > > | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | #f)) (define (udat-captain-host-port udata) (if (and (udat-captain-address udata)(udat-captain-port udata)) (conc (udat-captain-address udata) ":" (udat-captain-port udata)) #f)) (define (udat-get-peer udata host-port) (hash-table-ref/default (udat-peers udata) host-port #f)) ;; struct for keeping track of others we are talking to (defstruct peer (addr-port #f) (hostname #f) (pid #f) ;; (inp #f) ;; (oup #f) (dbs '()) ;; list of databases this peer is currently handling ) (defstruct work (peer-dat #f) (handlerkey #f) (qrykey #f) |
︙ | ︙ | |||
358 359 360 361 362 363 364 | (udat-serv-listener-set! udata tlsn) udata)) (define (get-peer-dat udata host-port #!optional (hostname #f)(pid #f)) ;; I'm currently very fuzzy on whether it makes sense to be reusing the outgoing connections. ;; at the other end of the line I think the reciever has closed the ports - thus each message ;; requires new connection? | | < < < < < < < < < < > > > | | | < | | > | | | | | | | | | | | | | | | | | | | | | | | | | > > > | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | (udat-serv-listener-set! udata tlsn) udata)) (define (get-peer-dat udata host-port #!optional (hostname #f)(pid #f)) ;; I'm currently very fuzzy on whether it makes sense to be reusing the outgoing connections. ;; at the other end of the line I think the reciever has closed the ports - thus each message ;; requires new connection? (let* ((pdat (or (udat-get-peer udata host-port) (handle-exceptions ;; ERROR - MAKE THIS EXCEPTION HANDLER MORE SPECIFIC exn #f (let ((npdat (make-peer addr-port: host-port))) (if hostname (peer-hostname-set! npdat hostname)) (if pid (peer-pid-set! npdat pid)) npdat))))) pdat)) ;; send structured data to recipient ;; ;; NOTE: qrykey is what was called the "cookie" previously ;; ;; retval tells send to expect and wait for return data (one line) and return it or time out ;; this is for ping where we don't want to necessarily have set up our own server yet. ;; (define (send udata host-port handler qrykey data #!key (hostname #f)(pid #f)(params '())(retval #f)) (handle-exceptions ;; ERROR - MAKE THIS EXCEPTION HANDLER MORE SPECIFIC exn #f (let-values (((inp oup)(tcp-connect host-port))) ;; ;; CONTROL LINE: ;; handlerkey host:port pid qrykey params ... ;; (let ((res (if (and inp oup) (let* ((myhost (udat-my-address udata)) (myport (udat-my-port udata)) (dat (conc handler " " (udat-my-address udata) ":" (udat-my-port udata) " " ;; (udat-my-hostname udata) " " (udat-my-pid udata) " " qrykey (if (null? params) "" (conc " " (string-intersperse params " ")))))) (if (and myhost myport) (begin (write-line dat oup) (write-line data oup) ;; (print "Sent dat: " dat " data: " data) (if retval (read-line inp) #t)) (begin (print "ERROR: send called but no receiver has been setup. Please call setup first!") #f)) ;; NOTE: DO NOT BE TEMPTED TO LOOK AT ANY DATA ON INP HERE! ;; (there is a listener for handling that) ) #f))) ;; #f means failed to connect and send (close-input-port inp) (close-output-port oup) res)))) ;; send a request to the given host-port and register a mailbox in udata ;; wait for the mailbox data and return it ;; (define (send-receive udata host-port handler qrykey data #!key (hostname #f)(pid #f)(params '())(timeout 20)) (let ((mbox (make-mailbox)) (mbox-time (current-milliseconds)) |
︙ | ︙ |