Megatest

Check-in [848a55348a]
Login
Overview
Comment:Fixed connect-server by adding use tcp6 to run.scm
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65-ulex-try-again
Files: files | file ages | folders
SHA1: 848a55348ac1637b8dfd9c4f5ad3a6f0c36d0c30
User & Date: matt on 2020-12-13 20:48:15
Other Links: branch diff | manifest | tags
Context
2020-12-16
23:12
Merged in v1.65, fixed Makefile and removed pkts from megatest/ulex.scm check-in: 96e98c0e2c user: matt tags: v1.65-ulex-try-again
2020-12-13
20:48
Fixed connect-server by adding use tcp6 to run.scm check-in: 848a55348a user: matt tags: v1.65-ulex-try-again
2020-12-12
20:30
Pulling netutil, portlogger and telemetry back into the ulex dir for consolidation etc. check-in: 07aff9dfdb user: matt tags: v1.65-ulex-try-again
Changes

Modified ulex/tests/run.scm from [92756dcfd4] to [f59b10a27d].

1
2
3
4
5
6
7


8

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(use test
     (prefix sqlite3 sqlite3:)
     posix
     ;; ulex-netutil rpc
     pkts
     mailbox
     hostinfo)




;; (use (prefix ulex ulex:))
(if (file-exists? "ulex.scm")
    (load "ulex.scm")
    (load "../ulex.scm"))

(use trace)
(trace-call-sites #t)

(import ulex) ;; (import (prefix ulex ulex:))

(trace
 ;; find-or-setup-captain
 get-all-captain-pkts
 setup-as-captain
 get-winning-pkt
 ping
 remove-captain-pkt
 ;; start-server-find-port
 ;; connect-server
 )

(test-begin "addresses")
(test #f #t (not (null? (get-all-ips))))
(test #f #t (string? (get-my-best-address)))






|
>
>

>

|
|
|








|
|
|
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(use test
     (prefix sqlite3 sqlite3:)
     posix
     ;; ulex-netutil rpc
     pkts
     mailbox
     hostinfo
     regex
     tcp6)

(include "ulex.scm")
;; (use (prefix ulex ulex:))
;; (if (file-exists? "ulex.scm")
;;     (load "ulex.scm")
;;     (load "../ulex.scm"))

(use trace)
(trace-call-sites #t)

(import ulex) ;; (import (prefix ulex ulex:))

(trace
 ;; find-or-setup-captain
 ;; get-all-captain-pkts
 ;; setup-as-captain
 ;; get-winning-pkt
 ;; ping
 ;; remove-captain-pkt
 ;; start-server-find-port
 ;; connect-server
 )

(test-begin "addresses")
(test #f #t (not (null? (get-all-ips))))
(test #f #t (string? (get-my-best-address)))

Modified ulex/ulex.scm from [3830009eae] to [4ef1a2fa98].

547
548
549
550
551
552
553

554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569

570
571
572
573
574
575
576
;;  if there is already a serv-listener return the udata
;;
(define (start-server-find-port udata-in #!optional (port 4242)(tries 0))
  (let ((udata (or udata-in (make-udat))))
    (if (udat-serv-listener udata) ;; TODO - add check that the listener is alive and ready?
	udata
	(let ((res (connect-server udata port)))

	  (or res
	      (begin
		;; (print "Could not connect to " port)
		(if (and (< port  65535)
			 (< tries 10000)) ;; make this number bigger when things are working
		    (start-server-find-port udata (+ port 1)(+ tries 1))
		    #f)))))))

(define (connect-server udata port)
  ;; (tcp-listener-socket LISTENER)(socket-name so)
  ;; sockaddr-address, sockaddr-port, sockaddr->string
  (let* ((tlsn (handle-exceptions
		   exn
		   (begin
		     ;; (print "unable to connect to " port ", exn=" exn)
		     #f)

		 (tcp-listen port 1000 #f))) ;; (tcp-listen TCPPORT [BACKLOG [HOST]])
	 (addr (get-my-best-address))) ;; (hostinfo-addresses (host-information (current-hostname)))
    (if tlsn
	(begin
	  (udat-my-address-set!    udata addr)
	  (udat-my-port-set!       udata port)
	  (udat-my-hostname-set!   udata (get-host-name))







>
|












<
<
<
>







547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567



568
569
570
571
572
573
574
575
;;  if there is already a serv-listener return the udata
;;
(define (start-server-find-port udata-in #!optional (port 4242)(tries 0))
  (let ((udata (or udata-in (make-udat))))
    (if (udat-serv-listener udata) ;; TODO - add check that the listener is alive and ready?
	udata
	(let ((res (connect-server udata port)))
	  (if res
	      res
	      (begin
		;; (print "Could not connect to " port)
		(if (and (< port  65535)
			 (< tries 10000)) ;; make this number bigger when things are working
		    (start-server-find-port udata (+ port 1)(+ tries 1))
		    #f)))))))

(define (connect-server udata port)
  ;; (tcp-listener-socket LISTENER)(socket-name so)
  ;; sockaddr-address, sockaddr-port, sockaddr->string
  (let* ((tlsn (handle-exceptions
		   exn



		   #f ;; NB// NEED BETTER HANDLING HERE ASAP
		 (tcp-listen port 1000 #f))) ;; (tcp-listen TCPPORT [BACKLOG [HOST]])
	 (addr (get-my-best-address))) ;; (hostinfo-addresses (host-information (current-hostname)))
    (if tlsn
	(begin
	  (udat-my-address-set!    udata addr)
	  (udat-my-port-set!       udata port)
	  (udat-my-hostname-set!   udata (get-host-name))