Megatest

Check-in [8de206008d]
Login
Overview
Comment:Don't fixate on first possible best server, if it isn't good keep on looking for a good candidate
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | server-log-handshaking
Files: files | file ages | folders
SHA1: 8de206008d9047e0cd2f740c6dd360fc0c0538c6
User & Date: mrwellan on 2017-01-31 13:20:47
Other Links: branch diff | manifest | tags
Context
2017-02-01
09:48
Added accelerated back-off in server:kind-run check-in: 33121e3cd8 user: mrwellan tags: server-log-handshaking
2017-01-31
13:20
Don't fixate on first possible best server, if it isn't good keep on looking for a good candidate check-in: 8de206008d user: mrwellan tags: server-log-handshaking
2017-01-30
14:24
Fixed debug message print that was missing the port check-in: 8149616a1d user: mrwellan tags: server-log-handshaking
Changes

Modified server.scm from [878167efea] to [cac20c539c].

282
283
284
285
286
287
288
289
290


291
292





293
294



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
       #f
       (- (current-seconds)
          (file-modification-time server-file))))))
    
;; no longer care if multiple servers are started by accident. older servers will drop off in time.
;;
(define (server:check-if-running areapath)
  (let* ((servers       (server:get-best (server:get-list areapath)))
	 (best-server   (if (null? servers) #f (car servers)))


	 (dotserver-url (if best-server
			    (server:record->url best-server)





			    #f))) ;; (server:read-dotserver->url areapath))) ;; tdbdat (tasks:open-db)))
    (if dotserver-url



	(let* ((res (case *transport-type*
		      ((http)(server:ping dotserver-url))
		      ;; ((nmsg)(nmsg-transport:ping (tasks:hostinfo-get-interface server)
		      )))
	  (if res
	      dotserver-url
	      (begin
		;; (server:kill best-server)
                #f)))
	#f)))

(define (server:kill servr)
  (match-let (((mod-time hostname port start-time pid)
	       servr))
    (tasks:kill-server hostname pid)))








|
|
>
>
|
|
>
>
>
>
>
|
|
>
>
>
|
|
|
|
|
|
<
<
<







282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310



311
312
313
314
315
316
317
       #f
       (- (current-seconds)
          (file-modification-time server-file))))))
    
;; no longer care if multiple servers are started by accident. older servers will drop off in time.
;;
(define (server:check-if-running areapath)
  (let* ((servers       (server:get-best (server:get-list areapath))))
    (if (null? servers)
        #f
        (let loop ((hed (car servers))
                   (tal (cdr servers)))
          (let ((res (server:check-server hed)))
            (if res
                res
                (if (null? tal)
                    #f
                    (loop (car tal)(cdr tal)))))))))

;; ping the given server
;;
(define (server:check-server server-record)
  (let* ((server-url (server:record->url server-record))
         (res        (case *transport-type*
                       ((http)(server:ping server-url))
                       ;; ((nmsg)(nmsg-transport:ping (tasks:hostinfo-get-interface server)
                       )))
    (if res
        server-url



	#f)))

(define (server:kill servr)
  (match-let (((mod-time hostname port start-time pid)
	       servr))
    (tasks:kill-server hostname pid)))