Overview
Comment: | common:send-dboard-main-changed works |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.60 |
Files: | files | file ages | folders |
SHA1: |
cf6c83c1d7ec928c7b1f154990041f5f |
User & Date: | matt on 2015-06-24 23:17:33 |
Other Links: | branch diff | manifest | tags |
Context
2015-06-25
| ||
00:15 | Added reading of test data check-in: eaf10c5502 user: matt tags: v1.60 | |
2015-06-24
| ||
23:17 | common:send-dboard-main-changed works check-in: cf6c83c1d7 user: matt tags: v1.60 | |
2015-06-23
| ||
23:14 | Areas reprocess only when main.db updated - well, almost check-in: cb104e663d user: matt tags: v1.60 | |
Changes
Modified common.scm from [16abff04a4] to [ec352267c4].
︙ | ︙ | |||
156 157 158 159 160 161 162 | (if (> (- currtime lasttime) waitval) (begin (hash-table-set! *common:denoise* key currtime) #t) #f))) (define (common:get-megatest-exe) | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | (if (> (- currtime lasttime) waitval) (begin (hash-table-set! *common:denoise* key currtime) #t) #f))) (define (common:get-megatest-exe) (or (getenv "MT_MEGATEST") "megatest")) (define (common:read-encoded-string instr) (handle-exceptions exn (handle-exceptions exn (begin |
︙ | ︙ | |||
766 767 768 769 770 771 772 773 774 | (set! res adr))) ;; NOTE: This can fail when there is no mention of the host in /etc/hosts. FIXME (vector->list (hostinfo-addresses (hostname->hostinfo hostname)))) (string-intersperse (map number->string (u8vector->list (if res res (hostname->ip hostname)))) "."))) (define (common:send-dboard-main-changed) | > > > > > > > > > > > > > | > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 | (set! res adr))) ;; NOTE: This can fail when there is no mention of the host in /etc/hosts. FIXME (vector->list (hostinfo-addresses (hostname->hostinfo hostname)))) (string-intersperse (map number->string (u8vector->list (if res res (hostname->ip hostname)))) "."))) (define (common:open-nm-req addr) (let* ((req (nn-socket 'req)) (res (nn-connect req addr))) req)) ;; (with-output-to-string (lambda ()(serialize obj))) (define (common:nm-send-receive soc msg) (nn-send soc msg) (nn-recv soc)) (define (common:close-nm-req soc) (nn-close soc)) (define (common:send-dboard-main-changed) (let* ((dashboard-ips (mddb:get-dashboards))) (for-each (lambda (ipadr) (let* ((soc (common:open-nm-req (conc "tcp://" ipadr))) (msg (conc "main " *toppath*)) (res (common:nm-send-receive-timeout soc msg))) (if (not res) ;; couldn't reach that dashboard - remove it from db (print "ERROR: couldn't reach dashboard " ipadr)) res)) dashboard-ips))) (define (common:nm-send-receive-timeout req msg) (let* ((key "ping") (success #f) (keepwaiting #t) (result #f) (sendrec (make-thread (lambda () (nn-send req msg) (set! result (nn-recv req)) (set! success #t)) "send-receive")) (timeout (make-thread (lambda () (let loop ((count 0)) (thread-sleep! 1) (print "still waiting after count seconds...") (if (and keepwaiting (< count 10)) (loop (+ count 1)))) (if keepwaiting (begin (print "timeout waiting for reply") (thread-terminate! sendrec)))) "timeout"))) (handle-exceptions exn (begin (print-call-chain) (print 0 " message: " ((condition-property-accessor 'exn 'message) exn)) (print "exn=" (condition->list exn))) (thread-start! timeout) (thread-start! sendrec) (thread-join! sendrec) (if success (thread-terminate! timeout))) result)) (define (common:ping-nm req) ;; send a random number and check that we get it back (let* ((key "ping") (success #f) (keepwaiting #t) (ping (make-thread (lambda () (print "ping: sending string \"" key "\", expecting " (current-process-id)) (nn-send req key) (let ((result (nn-recv req))) (if (equal? (conc (current-process-id)) result) (begin (print "ping, success: received \"" result "\"") (set! success #t)) (begin (print "ping, failed: received key \"" result "\"") (set! keepwaiting #f) (set! success #f))))) "ping")) (timeout (make-thread (lambda () (let loop ((count 0)) (thread-sleep! 1) (print "still waiting after count seconds...") (if (and keepwaiting (< count 10)) (loop (+ count 1)))) (if keepwaiting (begin (print "timeout waiting for ping") (thread-terminate! ping)))) "timeout"))) (handle-exceptions exn (begin (print-call-chain) (print 0 " message: " ((condition-property-accessor 'exn 'message) exn)) (print "exn=" (condition->list exn)) (print "ping failed to connect to tcp://" hostport)) (thread-start! timeout) (thread-start! ping) (thread-join! ping) (if success (thread-terminate! timeout))) (if return-socket (if success req #f) (begin (nn-close req) success)))) ;;====================================================================== ;; D A S H B O A R D D B ;;====================================================================== (define (mddb:open-db) (let* ((db (open-database (conc (get-environment-variable "HOME") "/.dashboard.db")))) |
︙ | ︙ |
Modified multi-dboard.scm from [0673e56b7f] to [b9da0d0861].
︙ | ︙ | |||
467 468 469 470 471 472 473 474 475 476 477 478 479 480 | (define (dboard:server-service soc port) (print "server starting") (let loop ((msg-in (nn-recv soc)) (count 0)) (if (eq? 0 (modulo count 1000)) (print "server received: " msg-in ", count=" count)) (cond ((equal? msg-in "quit") (nn-send soc "Ok, quitting")) ((and (>= (string-length msg-in) 4) (equal? (substring msg-in 0 4) "ping")) (nn-send soc (conc (current-process-id))) (loop (nn-recv soc)(+ count 1))) (else | > > > > > > > > > > > > > > > > > < < < < | | | | | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | (define (dboard:server-service soc port) (print "server starting") (let loop ((msg-in (nn-recv soc)) (count 0)) (if (eq? 0 (modulo count 1000)) (print "server received: " msg-in ", count=" count)) (cond ;; ;; quit ;; ((equal? msg-in "quit") (nn-send soc "Ok, quitting")) ;; ;; ping ;; ((and (>= (string-length msg-in) 4) (equal? (substring msg-in 0 4) "ping")) (nn-send soc (conc (current-process-id))) (loop (nn-recv soc)(+ count 1))) ;; ;; main changed ;; ((and (>= (string-length msg-in) 4) (equal? (substring msg-in 0 4) "main")) (let ((parts (string-split msg-in " "))) (hash-table-set! *changed-main* (cadr parts) #t) (nn-send soc "got it!"))) ;; ;; ?? ;; (else (nn-send soc "hello " msg-in " you got to the else clause!"))) (loop (nn-recv soc)(if (> count 20000000) 0 (+ count 1))))) (define (dboard:one-time-ping-receive soc port) (let ((msg-in (nn-recv soc))) (if (and (>= (string-length msg-in) 4) (equal? (substring msg-in 0 4) "ping")) (nn-send soc (conc (current-process-id)))))) |
︙ | ︙ |