Overview
Comment: | Fixed remotediff example. Broken by unknown goof up. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.62 |
Files: | files | file ages | folders |
SHA1: |
9833288949f3fbda311daa177e2d0e99 |
User & Date: | mrwellan on 2016-11-16 10:12:10 |
Other Links: | branch diff | manifest | tags |
Context
2016-11-16
| ||
13:48 | Try using md5sum instead of sha1. Much faster but what is the collison risk? check-in: 3e767a9aad user: mrwellan tags: v1.62, v1.6208 | |
10:12 | Fixed remotediff example. Broken by unknown goof up. check-in: 9833288949 user: mrwellan tags: v1.62 | |
2016-11-11
| ||
10:59 | Added deploy makefile check-in: 9c2e96a8c8 user: jmoon18 tags: v1.62 | |
Changes
Modified remotediff-nmsg.scm from [c101aad63b] to [e39151f87a].
︙ | ︙ | |||
8 9 10 11 12 13 14 | (nn-recv soc)) ;;do as calling user (define (do-as-calling-user proc) (let ((eid (current-effective-user-id)) (cid (current-user-id))) (if (not (eq? eid cid)) ;; running suid | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | (nn-recv soc)) ;;do as calling user (define (do-as-calling-user proc) (let ((eid (current-effective-user-id)) (cid (current-user-id))) (if (not (eq? eid cid)) ;; running suid (set! (current-effective-user-id) cid)) (proc) (if (not (eq? eid cid)) (set! (current-effective-user-id) eid)))) ;; use mutex to not open/close files at same time ;; (define (checksum mtx file) |
︙ | ︙ | |||
44 45 46 47 48 49 50 | (let ((mtx1 (make-mutex)) (threads (make-hash-table)) (last-num 0) (req (nn-socket 'req))) (print "starting client with pid " (current-process-id)) (nn-connect req "tcp://localhost:5559") | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | (let ((mtx1 (make-mutex)) (threads (make-hash-table)) (last-num 0) (req (nn-socket 'req))) (print "starting client with pid " (current-process-id)) (nn-connect req "tcp://localhost:5559") ;; "ipc:///tmp/test-ipc") (find-files path ;; test: #t action: (lambda (p res) (let ((info (cond ((not (file-read-access? p)) '(cant-read)) ((directory? p) '(dir)) |
︙ | ︙ | |||
110 111 112 113 114 115 116 | (client-send-receive req "quit") (nn-close req) (exit))) ;; recieve and store the file data, note: this is effectively a *server*, not a client. ;; (define (compare-directories path1 path2) | < | | > > > | | | | | | | | > | | | | | | | | | > | > > > | > | | | > | > | | > | < | | > > > > > > > > > > | | 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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | (client-send-receive req "quit") (nn-close req) (exit))) ;; recieve and store the file data, note: this is effectively a *server*, not a client. ;; (define (compare-directories path1 path2) (let ((p1dat (make-hash-table)) (p2dat (make-hash-table)) (numdone 0) ;; increment when recieved a quit. exit when > 2 (rep (nn-socket 'rep)) (p1len (string-length path1)) (p2len (string-length path2)) (both-seen (make-hash-table))) (nn-bind rep "tcp://*:5559") ;; "ipc:///tmp/test-ipc") ;; start clients (thread-sleep! 0.1) (system (conc "./remotediff-nmsg " path1 " &")) (system (conc "./remotediff-nmsg " path2 " &")) (let loop ((msg-in (nn-recv rep)) (last-print 0)) (if (equal? msg-in "quit") (set! numdone (+ numdone 1))) (if (and (not (equal? msg-in "quit")) (< numdone 2)) (let* ((parts (string-split msg-in)) (filen (car parts)) (finfo (cadr parts)) (isp1 (substring-index path1 filen 0)) ;; is this a path1? (isp2 (substring-index path2 filen 0)) ;; is this a path2? (tpth (substring filen (if isp1 p1len p2len) (string-length filen)))) (hash-table-set! (if isp1 p1dat p2dat) tpth finfo) (if (and (hash-table-exists? p1dat tpth) (hash-table-exists? p2dat tpth)) (begin (if (not (equal? (hash-table-ref p1dat tpth) (hash-table-ref p2dat tpth))) (print "DIFF: " tpth)) (hash-table-set! both-seen tpth finfo))) (nn-send rep "done") (loop (nn-recv rep) (if (> (- (current-seconds) last-print) 15) (begin (print "Processed " (hash-table-size p1dat) ", " (hash-table-size p2dat)) (current-seconds)) last-print))))) (print "p1: " (hash-table-size p1dat) " p2: " (hash-table-size p2dat)) (hash-table-for-each p1dat (lambda (k v) (if (not (hash-table-exists? p2dat k)) (print "REMOVED: " k)))) (hash-table-for-each p2dat (lambda (k v) (if (not (hash-table-exists? p1dat k)) (print "ADDED: " k)))) (list p1dat p2dat))) (if (< (length (argv)) 2) (begin (print "Usage: remotediff-nmsg file1 file2") (exit))) (if (eq? (length (argv)) 2) ;; given a single path (gather-dir-info (cadr (argv))) (compare-directories (cadr (argv))(caddr (argv)))) (print "Done") |