Megatest

Check-in [c127520a98]
Login
Overview
Comment:Fixed connect-server by adding use tcp6 to run.scm From: 848a55348ac1637b8dfd9c4f5ad3a6f0c36d0c30 User: matt
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65-real-ulex
Files: files | file ages | folders
SHA1: c127520a987eb3794acb676671c0658f943e221a
User & Date: matt on 2021-02-25 23:12:31
Other Links: branch diff | manifest | tags
Context
2021-02-25
23:12
Merged in v1.65, fixed Makefile and removed pkts from megatest/ulex.scm From: 96e98c0e2cd3c8b7f71f8667bfc5874dfb86c0a3 User: matt check-in: 8c461d1e04 user: matt tags: v1.65-real-ulex (unpublished)
23:12
Fixed connect-server by adding use tcp6 to run.scm From: 848a55348ac1637b8dfd9c4f5ad3a6f0c36d0c30 User: matt check-in: c127520a98 user: matt tags: v1.65-real-ulex (unpublished)
23:12
Pulling netutil, portlogger and telemetry back into the ulex dir for consolidation etc. From: 07aff9dfdb76799cccd39e08dda8706a92453947 User: matt check-in: 49c01cca51 user: matt tags: v1.65-real-ulex (unpublished)
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))