Megatest

Check-in [dfe64d8ddb]
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: dfe64d8ddbe9611135e7d3848641cbdd3610bd1f
User & Date: mrwellan on 2014-09-03 16:39:09
Other Links: branch diff | manifest | tags
Context
2014-09-03
17:54
Switch to -daemonize as it seems problematic to start servers under nbfake check-in: 4c9c6ff4b4 user: mrwellan tags: v1.60
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
Changes

Modified portlogger.scm from [5508c67588] to [68db235c39].

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))







|
|
|
|
|
|
|
|







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))