@@ -56,11 +56,6 @@ SRCPORTS=()
56
56
DSTS=()
57
57
DSTPORTS=()
58
58
59
- get_alphabetic () {
60
- id=" $1 "
61
- ida=$( echo " $1 " | sed -e ' s/0/zero/g; s/1/one/g; s/2/two/g; s/3/three/g; s/4/four/g; s/5/five/g; s/6/six/g; s/7/seven/g; s/8/eight/g; s/9/nine/g;' )
62
- }
63
-
64
59
validate () {
65
60
status=0
66
61
# Have at least one default.
@@ -513,22 +508,48 @@ clients)
513
508
exit 0
514
509
;;
515
510
516
- relay )
511
+ connect )
517
512
. " $NCONFIG "
518
513
519
514
paths=
520
515
for i in ${! SRCS[@]} ; do
521
516
src=${SRCS[$i]}
522
- get_alphabetic " $src "
523
- srca=$ida
517
+ dst=${DSTS[$i]}
524
518
519
+ path=" path-$i "
520
+ paths=" $paths $path "
521
+ echo " Starting 'rly tx conn $path ' ($src <>$dst ) logs in $LOGS /$path .log"
522
+ (
523
+ try=0
524
+ while ! rly tx conn $path --timeout=3s -d >> " $LOGS /$path .log" 2>&1 ; do
525
+ try=$(( $try + 1 ))
526
+ echo " $path tx conn not yet ready (try=$try )"
527
+ sleep 1
528
+ done
529
+ try=$(( $try + 1 ))
530
+ echo " $path tx conn initialized (try=$try )"
531
+ ) &
532
+ done
533
+
534
+ wait
535
+ echo " ==============================="
536
+ echo " === All connections initialized"
537
+ for path in $paths ; do
538
+ tail -1 " $LOGS /$path .log"
539
+ done
540
+ echo " ==============================="
541
+ exit 0
542
+ ;;
543
+
544
+ relay)
545
+ . " $NCONFIG "
546
+
547
+ paths=
548
+ for i in ${! SRCS[@]} ; do
549
+ src=${SRCS[$i]}
525
550
dst=${DSTS[$i]}
526
- get_alphabetic " $dst "
527
- dsta=$ida
528
551
529
- get_alphabetic " $i "
530
- ia=$ida
531
- path=" $ia "
552
+ path=" path-$i "
532
553
paths=" $paths $path "
533
554
echo " Starting 'rly tx link $path ' ($src <>$dst ) logs in $LOGS /$path .log"
534
555
(
@@ -627,34 +648,22 @@ done
627
648
for i in ${! SRCS[@]} ; do
628
649
src=${SRCS[$i]}
629
650
srcport=${SRCPORTS[$i]}
630
- get_alphabetic " $src "
631
- srca=$ida
632
651
633
652
dst=${DSTS[$i]}
634
653
dstport=${DSTPORTS[$i]}
635
- get_alphabetic " $dst "
636
- dsta=$ida
637
654
638
- get_alphabetic " $i "
639
- ia=$ida
640
- path=" $ida "
655
+ path=" path-$i "
641
656
out=" $BASEDIR /config/$path .json"
642
657
echo " creating $out "
643
658
cat > " $out " << EOF
644
659
{
645
660
"src": {
646
661
"chain-id": "$src ",
647
- "client-id": "${dsta} client",
648
- "connection-id": "${dsta} link",
649
- "channel-id": "${dsta} xfer${ida} ",
650
662
"port-id": "$srcport ",
651
663
"order": "unordered"
652
664
},
653
665
"dst": {
654
666
"chain-id": "$dst ",
655
- "client-id": "${srca} client",
656
- "connection-id": "${srca} link",
657
- "channel-id": "${srca} xfer${ida} ",
658
667
"port-id": "$dstport ",
659
668
"order": "unordered"
660
669
},
@@ -671,7 +680,7 @@ cat <<EOF
671
680
=====================
672
681
Done generating $BASEDIR
673
682
674
- You can use: \` $progname [run|relay]' at any time.
683
+ You can use: \` $progname [run|connect| relay]' at any time.
675
684
676
685
EOF
677
686
@@ -680,7 +689,7 @@ if [[ $SKIP == norun ]]; then
680
689
fi
681
690
682
691
if [[ $SKIP != yes ]]; then
683
- read -p " Do you wish to \` run', and \` relay ' right now (y/N)? " -n 1 -r
692
+ read -p " Do you wish to \` run', and \` connect ' right now (y/N)? " -n 1 -r
684
693
echo
685
694
686
695
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
@@ -689,6 +698,6 @@ if [[ $SKIP != yes ]]; then
689
698
fi
690
699
691
700
" $0 " run skip &
692
- " $0 " relay skip &
701
+ " $0 " connect skip &
693
702
echo " Hit Control-C to exit"
694
703
wait
0 commit comments