Megatest

Check-in [db5ce0a47b]
Login
Overview
Comment:Increase range of ports to pick from and add configurability for lowport
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: db5ce0a47b810870621fe9b66149c891b8140439
User & Date: mrwellan on 2014-09-03 16:35:05
Other Links: branch diff | manifest | tags
Context
2014-09-03
16:39
Increase range of ports to pick from and add configurability for lowport check-in: dfe64d8ddb user: mrwellan tags: v1.60
16:35
Increase range of ports to pick from and add configurability for lowport check-in: db5ce0a47b user: mrwellan tags: v1.60
15:48
Switch out dot locking with waiting on journal file gone. check-in: f88ca3aa69 user: mrwellan tags: v1.60
Changes

Modified portlogger.scm from [5a6661b1a7] to [5508c67588].

90
91
92
93
94
95
96





97
98
99
100
101
102
103
104
105
106
   (lambda (var curr)
     (or curr var curr))
   #f
   db
   "SELECT (port) FROM ports WHERE state='released' LIMIT 1;"))

(define (portlogger:find-port db)





  (let ((portnum (or (portlogger:get-prev-used-port db)
		     (+ 50000 ;; top of registered ports
			(random (- 60000 50000))))))
    (portlogger:take-port db portnum)
    portnum))

;; set port to "released", "failed" etc.
;; 
(define (portlogger:set-port db portnum value)
  (sqlite3:execute db "UPDATE ports SET state=?,update_time=strftime('%s','now') WHERE port=?;" value portnum))







>
>
>
>
>
|
|
|







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
   (lambda (var curr)
     (or curr var curr))
   #f
   db
   "SELECT (port) FROM ports WHERE state='released' LIMIT 1;"))

(define (portlogger:find-port db)
  (let ((lowport (let ((val (configf:lookup *configdat* "server" "lowport")))
		   (if (and val 
			    (string->number val))
		       (string->number val)
		       32768)))
	(portnum (or (portlogger:get-prev-used-port db)
		     (+ lowport ;; top of registered ports is 49152 but lets use ports in the registered range
			(random (- 64000 lowport))))))
    (portlogger:take-port db portnum)
    portnum))

;; set port to "released", "failed" etc.
;; 
(define (portlogger:set-port db portnum value)
  (sqlite3:execute db "UPDATE ports SET state=?,update_time=strftime('%s','now') WHERE port=?;" value portnum))