Implement initial Python bindings for Open vSwitch database.
[sliver-openvswitch.git] / tests / reconnect.at
1 AT_BANNER([reconnect library])
2
3 m4_define([__RECONNECT_CHECK],
4   [AT_SETUP([$1])
5    $2
6    AT_KEYWORDS([reconnect])
7    AT_DATA([input], [$3])
8    AT_CHECK([$4], [0], [$5])
9    AT_CLEANUP])
10
11 m4_define([RECONNECT_CHECK],
12   [__RECONNECT_CHECK(
13      [$1 - C],
14      [],
15      [$2],
16      [test-reconnect < input],
17      [$3])
18    __RECONNECT_CHECK(
19      [$1 - Python],
20      [AT_SKIP_IF([test $HAVE_PYTHON = no])],
21      [$2],
22      [$PYTHON $srcdir/test-reconnect.py < input],
23      [$3])])
24
25 ######################################################################
26 RECONNECT_CHECK([nothing happens if not enabled],
27   [run
28 timeout
29 ],
30   [### t=1000 ###
31 run
32 timeout
33   no timeout
34 ])
35
36 ######################################################################
37 RECONNECT_CHECK([quick connect, idle disconnect],
38   [enable
39
40 # Connection succeeds.
41 run
42 connected
43
44 # Send inactivity probe.
45 timeout
46 run
47
48 # Idle timeout kills connection.
49 timeout
50 run
51 disconnected
52 ],
53   [### t=1000 ###
54 enable
55   in BACKOFF for 0 ms (0 ms backoff)
56
57 # Connection succeeds.
58 run
59   should connect
60 connected
61   in ACTIVE for 0 ms (0 ms backoff)
62   1 successful connections out of 1 attempts, seqno 1
63   connected (0 ms), total 0 ms connected
64
65 # Send inactivity probe.
66 timeout
67   advance 5000 ms
68
69 ### t=6000 ###
70   in ACTIVE for 5000 ms (0 ms backoff)
71   connected (5000 ms), total 5000 ms connected
72 run
73   should send probe
74   in IDLE for 0 ms (0 ms backoff)
75
76 # Idle timeout kills connection.
77 timeout
78   advance 5000 ms
79
80 ### t=11000 ###
81   in IDLE for 5000 ms (0 ms backoff)
82   connected (10000 ms), total 10000 ms connected
83 run
84   should disconnect
85 disconnected
86   in BACKOFF for 0 ms (1000 ms backoff)
87   1 successful connections out of 1 attempts, seqno 2
88   not connected (0 ms), total 10000 ms connected
89 ])
90
91 ######################################################################
92 RECONNECT_CHECK([slow connect, idle disconnect],
93   [enable
94
95 # Start connecting.
96 run
97 connecting
98
99 # Connect after 500 ms.
100 advance 500
101 run
102 connected
103
104 # Send inactivity probe.
105 timeout
106 run
107
108 # Idle timeout kills connection.
109 timeout
110 run
111 disconnected
112 ],
113   [### t=1000 ###
114 enable
115   in BACKOFF for 0 ms (0 ms backoff)
116
117 # Start connecting.
118 run
119   should connect
120 connecting
121   in CONNECT_IN_PROGRESS for 0 ms (0 ms backoff)
122
123 # Connect after 500 ms.
124 advance 500
125
126 ### t=1500 ###
127   in CONNECT_IN_PROGRESS for 500 ms (0 ms backoff)
128 run
129 connected
130   in ACTIVE for 0 ms (0 ms backoff)
131   created 1000, last received 1000, last connected 1500
132   1 successful connections out of 1 attempts, seqno 1
133   connected (0 ms), total 0 ms connected
134
135 # Send inactivity probe.
136 timeout
137   advance 5000 ms
138
139 ### t=6500 ###
140   in ACTIVE for 5000 ms (0 ms backoff)
141   connected (5000 ms), total 5000 ms connected
142 run
143   should send probe
144   in IDLE for 0 ms (0 ms backoff)
145
146 # Idle timeout kills connection.
147 timeout
148   advance 5000 ms
149
150 ### t=11500 ###
151   in IDLE for 5000 ms (0 ms backoff)
152   connected (10000 ms), total 10000 ms connected
153 run
154   should disconnect
155 disconnected
156   in BACKOFF for 0 ms (1000 ms backoff)
157   1 successful connections out of 1 attempts, seqno 2
158   not connected (0 ms), total 10000 ms connected
159 ])
160
161 ######################################################################
162 RECONNECT_CHECK([connect backs off],
163   [enable
164
165 # First connection attempt fails after 1000 ms.
166 run
167 connecting
168 run
169 timeout
170 run
171 connect-failed
172
173 # Back off for 1000 ms.
174 timeout
175 run
176
177 # Second connection attempt fails after 1000 ms.
178 connecting
179 timeout
180 run
181 connect-failed
182
183 # Back off for 2000 ms.
184 timeout
185 run
186
187 # Third connection attempt fails after 2000 ms.
188 connecting
189 timeout
190 run
191 connect-failed
192
193 # Back off for 4000 ms.
194 timeout
195 run
196
197 # Third connection attempt fails after 4000 ms.
198 connecting
199 timeout
200 run
201 connect-failed
202
203 # Back off for 8000 ms.
204 timeout
205 run
206
207 # Third connection attempt fails after 8000 ms.
208 connecting
209 timeout
210 run
211 connect-failed
212
213 # Back off for 8000 ms.
214 timeout
215 run
216
217 # Fourth connection attempt fails after 8000 ms.
218 connecting
219 timeout
220 run
221 connect-failed
222 ],
223   [### t=1000 ###
224 enable
225   in BACKOFF for 0 ms (0 ms backoff)
226
227 # First connection attempt fails after 1000 ms.
228 run
229   should connect
230 connecting
231   in CONNECT_IN_PROGRESS for 0 ms (0 ms backoff)
232 run
233 timeout
234   advance 1000 ms
235
236 ### t=2000 ###
237   in CONNECT_IN_PROGRESS for 1000 ms (0 ms backoff)
238 run
239   should disconnect
240 connect-failed
241   in BACKOFF for 0 ms (1000 ms backoff)
242   0 successful connections out of 1 attempts, seqno 0
243
244 # Back off for 1000 ms.
245 timeout
246   advance 1000 ms
247
248 ### t=3000 ###
249   in BACKOFF for 1000 ms (1000 ms backoff)
250 run
251   should connect
252
253 # Second connection attempt fails after 1000 ms.
254 connecting
255   in CONNECT_IN_PROGRESS for 0 ms (1000 ms backoff)
256 timeout
257   advance 1000 ms
258
259 ### t=4000 ###
260   in CONNECT_IN_PROGRESS for 1000 ms (1000 ms backoff)
261 run
262   should disconnect
263 connect-failed
264   in BACKOFF for 0 ms (2000 ms backoff)
265   0 successful connections out of 2 attempts, seqno 0
266
267 # Back off for 2000 ms.
268 timeout
269   advance 2000 ms
270
271 ### t=6000 ###
272   in BACKOFF for 2000 ms (2000 ms backoff)
273 run
274   should connect
275
276 # Third connection attempt fails after 2000 ms.
277 connecting
278   in CONNECT_IN_PROGRESS for 0 ms (2000 ms backoff)
279 timeout
280   advance 2000 ms
281
282 ### t=8000 ###
283   in CONNECT_IN_PROGRESS for 2000 ms (2000 ms backoff)
284 run
285   should disconnect
286 connect-failed
287   in BACKOFF for 0 ms (4000 ms backoff)
288   0 successful connections out of 3 attempts, seqno 0
289
290 # Back off for 4000 ms.
291 timeout
292   advance 4000 ms
293
294 ### t=12000 ###
295   in BACKOFF for 4000 ms (4000 ms backoff)
296 run
297   should connect
298
299 # Third connection attempt fails after 4000 ms.
300 connecting
301   in CONNECT_IN_PROGRESS for 0 ms (4000 ms backoff)
302 timeout
303   advance 4000 ms
304
305 ### t=16000 ###
306   in CONNECT_IN_PROGRESS for 4000 ms (4000 ms backoff)
307 run
308   should disconnect
309 connect-failed
310   in BACKOFF for 0 ms (8000 ms backoff)
311   0 successful connections out of 4 attempts, seqno 0
312
313 # Back off for 8000 ms.
314 timeout
315   advance 8000 ms
316
317 ### t=24000 ###
318   in BACKOFF for 8000 ms (8000 ms backoff)
319 run
320   should connect
321
322 # Third connection attempt fails after 8000 ms.
323 connecting
324   in CONNECT_IN_PROGRESS for 0 ms (8000 ms backoff)
325 timeout
326   advance 8000 ms
327
328 ### t=32000 ###
329   in CONNECT_IN_PROGRESS for 8000 ms (8000 ms backoff)
330 run
331   should disconnect
332 connect-failed
333   in BACKOFF for 0 ms (8000 ms backoff)
334   0 successful connections out of 5 attempts, seqno 0
335
336 # Back off for 8000 ms.
337 timeout
338   advance 8000 ms
339
340 ### t=40000 ###
341   in BACKOFF for 8000 ms (8000 ms backoff)
342 run
343   should connect
344
345 # Fourth connection attempt fails after 8000 ms.
346 connecting
347   in CONNECT_IN_PROGRESS for 0 ms (8000 ms backoff)
348 timeout
349   advance 8000 ms
350
351 ### t=48000 ###
352   in CONNECT_IN_PROGRESS for 8000 ms (8000 ms backoff)
353 run
354   should disconnect
355 connect-failed
356   in BACKOFF for 0 ms (8000 ms backoff)
357   0 successful connections out of 6 attempts, seqno 0
358 ])
359
360 ######################################################################
361 RECONNECT_CHECK([connections with no data preserve backoff],
362   [enable
363
364 # First connect, then idle timeout kills connection.
365 run
366 connected
367 timeout
368 run
369 timeout
370 run
371 disconnected
372
373 # Back off for 1000 ms.
374 timeout
375 run
376
377 # Second connect, then idle timeout kills connection.
378 run
379 connected
380 timeout
381 run
382 timeout
383 run
384 disconnected
385
386 # Back off for 2000 ms.
387 timeout
388 run
389
390 # Third connect, then idle timeout kills connection.
391 run
392 connected
393 timeout
394 run
395 timeout
396 run
397 disconnected
398
399 # Back off for 4000 ms.
400 timeout
401 ], [### t=1000 ###
402 enable
403   in BACKOFF for 0 ms (0 ms backoff)
404
405 # First connect, then idle timeout kills connection.
406 run
407   should connect
408 connected
409   in ACTIVE for 0 ms (0 ms backoff)
410   1 successful connections out of 1 attempts, seqno 1
411   connected (0 ms), total 0 ms connected
412 timeout
413   advance 5000 ms
414
415 ### t=6000 ###
416   in ACTIVE for 5000 ms (0 ms backoff)
417   connected (5000 ms), total 5000 ms connected
418 run
419   should send probe
420   in IDLE for 0 ms (0 ms backoff)
421 timeout
422   advance 5000 ms
423
424 ### t=11000 ###
425   in IDLE for 5000 ms (0 ms backoff)
426   connected (10000 ms), total 10000 ms connected
427 run
428   should disconnect
429 disconnected
430   in BACKOFF for 0 ms (1000 ms backoff)
431   1 successful connections out of 1 attempts, seqno 2
432   not connected (0 ms), total 10000 ms connected
433
434 # Back off for 1000 ms.
435 timeout
436   advance 1000 ms
437
438 ### t=12000 ###
439   in BACKOFF for 1000 ms (1000 ms backoff)
440 run
441   should connect
442
443 # Second connect, then idle timeout kills connection.
444 run
445   should connect
446 connected
447   in ACTIVE for 0 ms (1000 ms backoff)
448   created 1000, last received 1000, last connected 12000
449   2 successful connections out of 2 attempts, seqno 3
450   connected (0 ms), total 10000 ms connected
451 timeout
452   advance 5000 ms
453
454 ### t=17000 ###
455   in ACTIVE for 5000 ms (1000 ms backoff)
456   connected (5000 ms), total 15000 ms connected
457 run
458   should send probe
459   in IDLE for 0 ms (1000 ms backoff)
460 timeout
461   advance 5000 ms
462
463 ### t=22000 ###
464   in IDLE for 5000 ms (1000 ms backoff)
465   connected (10000 ms), total 20000 ms connected
466 run
467   should disconnect
468 disconnected
469   in BACKOFF for 0 ms (2000 ms backoff)
470   2 successful connections out of 2 attempts, seqno 4
471   not connected (0 ms), total 20000 ms connected
472
473 # Back off for 2000 ms.
474 timeout
475   advance 2000 ms
476
477 ### t=24000 ###
478   in BACKOFF for 2000 ms (2000 ms backoff)
479 run
480   should connect
481
482 # Third connect, then idle timeout kills connection.
483 run
484   should connect
485 connected
486   in ACTIVE for 0 ms (2000 ms backoff)
487   created 1000, last received 1000, last connected 24000
488   3 successful connections out of 3 attempts, seqno 5
489   connected (0 ms), total 20000 ms connected
490 timeout
491   advance 5000 ms
492
493 ### t=29000 ###
494   in ACTIVE for 5000 ms (2000 ms backoff)
495   connected (5000 ms), total 25000 ms connected
496 run
497   should send probe
498   in IDLE for 0 ms (2000 ms backoff)
499 timeout
500   advance 5000 ms
501
502 ### t=34000 ###
503   in IDLE for 5000 ms (2000 ms backoff)
504   connected (10000 ms), total 30000 ms connected
505 run
506   should disconnect
507 disconnected
508   in BACKOFF for 0 ms (4000 ms backoff)
509   3 successful connections out of 3 attempts, seqno 6
510   not connected (0 ms), total 30000 ms connected
511
512 # Back off for 4000 ms.
513 timeout
514   advance 4000 ms
515
516 ### t=38000 ###
517   in BACKOFF for 4000 ms (4000 ms backoff)
518 ])
519
520 ######################################################################
521 RECONNECT_CHECK([brief connection preserves backoff],
522   [enable
523
524 # First connection attempt fails after 1000 ms.
525 run
526 connecting
527 run
528 timeout
529 run
530 connect-failed
531
532 # Back off for 1000 ms.
533 timeout
534 run
535
536 # Second connection attempt fails after 1000 ms.
537 connecting
538 timeout
539 run
540 connect-failed
541
542 # Back off for 2000 ms.
543 timeout
544 run
545
546 # Third connection attempt succeeds after 500 ms.
547 connecting
548 advance 500
549 run
550 connected
551
552 # Connection drops after another 250 ms.
553 advance 250
554 disconnected
555 run
556
557 # Back off for 4000 ms.
558 timeout
559 run
560 ], [### t=1000 ###
561 enable
562   in BACKOFF for 0 ms (0 ms backoff)
563
564 # First connection attempt fails after 1000 ms.
565 run
566   should connect
567 connecting
568   in CONNECT_IN_PROGRESS for 0 ms (0 ms backoff)
569 run
570 timeout
571   advance 1000 ms
572
573 ### t=2000 ###
574   in CONNECT_IN_PROGRESS for 1000 ms (0 ms backoff)
575 run
576   should disconnect
577 connect-failed
578   in BACKOFF for 0 ms (1000 ms backoff)
579   0 successful connections out of 1 attempts, seqno 0
580
581 # Back off for 1000 ms.
582 timeout
583   advance 1000 ms
584
585 ### t=3000 ###
586   in BACKOFF for 1000 ms (1000 ms backoff)
587 run
588   should connect
589
590 # Second connection attempt fails after 1000 ms.
591 connecting
592   in CONNECT_IN_PROGRESS for 0 ms (1000 ms backoff)
593 timeout
594   advance 1000 ms
595
596 ### t=4000 ###
597   in CONNECT_IN_PROGRESS for 1000 ms (1000 ms backoff)
598 run
599   should disconnect
600 connect-failed
601   in BACKOFF for 0 ms (2000 ms backoff)
602   0 successful connections out of 2 attempts, seqno 0
603
604 # Back off for 2000 ms.
605 timeout
606   advance 2000 ms
607
608 ### t=6000 ###
609   in BACKOFF for 2000 ms (2000 ms backoff)
610 run
611   should connect
612
613 # Third connection attempt succeeds after 500 ms.
614 connecting
615   in CONNECT_IN_PROGRESS for 0 ms (2000 ms backoff)
616 advance 500
617
618 ### t=6500 ###
619   in CONNECT_IN_PROGRESS for 500 ms (2000 ms backoff)
620 run
621 connected
622   in ACTIVE for 0 ms (2000 ms backoff)
623   created 1000, last received 1000, last connected 6500
624   1 successful connections out of 3 attempts, seqno 1
625   connected (0 ms), total 0 ms connected
626
627 # Connection drops after another 250 ms.
628 advance 250
629
630 ### t=6750 ###
631   in ACTIVE for 250 ms (2000 ms backoff)
632   connected (250 ms), total 250 ms connected
633 disconnected
634   in BACKOFF for 0 ms (4000 ms backoff)
635   1 successful connections out of 3 attempts, seqno 2
636   not connected (0 ms), total 250 ms connected
637 run
638
639 # Back off for 4000 ms.
640 timeout
641   advance 4000 ms
642
643 ### t=10750 ###
644   in BACKOFF for 4000 ms (4000 ms backoff)
645 run
646   should connect
647 ])
648
649 ######################################################################
650 RECONNECT_CHECK([brief connection with data preserves backoff],
651   [enable
652
653 # First connection attempt fails after 1000 ms.
654 run
655 connecting
656 run
657 timeout
658 run
659 connect-failed
660
661 # Back off for 1000 ms.
662 timeout
663 run
664
665 # Second connection attempt fails after 1000 ms.
666 connecting
667 timeout
668 run
669 connect-failed
670
671 # Back off for 2000 ms.
672 timeout
673 run
674
675 # Third connection attempt succeeds after 500 ms.
676 connecting
677 advance 500
678 run
679 connected
680
681 # Connection receives 3 chunks of data spaced 250 ms apart.
682 advance 250
683 run
684 received
685 advance 250
686 run
687 received
688 advance 250
689 run
690 received
691
692 # Connection drops.
693 disconnected
694 run
695
696 # Back off for 4000 ms.
697 timeout
698 run
699 ],
700   [### t=1000 ###
701 enable
702   in BACKOFF for 0 ms (0 ms backoff)
703
704 # First connection attempt fails after 1000 ms.
705 run
706   should connect
707 connecting
708   in CONNECT_IN_PROGRESS for 0 ms (0 ms backoff)
709 run
710 timeout
711   advance 1000 ms
712
713 ### t=2000 ###
714   in CONNECT_IN_PROGRESS for 1000 ms (0 ms backoff)
715 run
716   should disconnect
717 connect-failed
718   in BACKOFF for 0 ms (1000 ms backoff)
719   0 successful connections out of 1 attempts, seqno 0
720
721 # Back off for 1000 ms.
722 timeout
723   advance 1000 ms
724
725 ### t=3000 ###
726   in BACKOFF for 1000 ms (1000 ms backoff)
727 run
728   should connect
729
730 # Second connection attempt fails after 1000 ms.
731 connecting
732   in CONNECT_IN_PROGRESS for 0 ms (1000 ms backoff)
733 timeout
734   advance 1000 ms
735
736 ### t=4000 ###
737   in CONNECT_IN_PROGRESS for 1000 ms (1000 ms backoff)
738 run
739   should disconnect
740 connect-failed
741   in BACKOFF for 0 ms (2000 ms backoff)
742   0 successful connections out of 2 attempts, seqno 0
743
744 # Back off for 2000 ms.
745 timeout
746   advance 2000 ms
747
748 ### t=6000 ###
749   in BACKOFF for 2000 ms (2000 ms backoff)
750 run
751   should connect
752
753 # Third connection attempt succeeds after 500 ms.
754 connecting
755   in CONNECT_IN_PROGRESS for 0 ms (2000 ms backoff)
756 advance 500
757
758 ### t=6500 ###
759   in CONNECT_IN_PROGRESS for 500 ms (2000 ms backoff)
760 run
761 connected
762   in ACTIVE for 0 ms (2000 ms backoff)
763   created 1000, last received 1000, last connected 6500
764   1 successful connections out of 3 attempts, seqno 1
765   connected (0 ms), total 0 ms connected
766
767 # Connection receives 3 chunks of data spaced 250 ms apart.
768 advance 250
769
770 ### t=6750 ###
771   in ACTIVE for 250 ms (2000 ms backoff)
772   connected (250 ms), total 250 ms connected
773 run
774 received
775   created 1000, last received 6750, last connected 6500
776 advance 250
777
778 ### t=7000 ###
779   in ACTIVE for 500 ms (2000 ms backoff)
780   connected (500 ms), total 500 ms connected
781 run
782 received
783   created 1000, last received 7000, last connected 6500
784 advance 250
785
786 ### t=7250 ###
787   in ACTIVE for 750 ms (2000 ms backoff)
788   connected (750 ms), total 750 ms connected
789 run
790 received
791   created 1000, last received 7250, last connected 6500
792
793 # Connection drops.
794 disconnected
795   in BACKOFF for 0 ms (4000 ms backoff)
796   1 successful connections out of 3 attempts, seqno 2
797   not connected (0 ms), total 750 ms connected
798 run
799
800 # Back off for 4000 ms.
801 timeout
802   advance 4000 ms
803
804 ### t=11250 ###
805   in BACKOFF for 4000 ms (4000 ms backoff)
806 run
807   should connect
808 ])
809
810 ######################################################################
811 RECONNECT_CHECK([long connection resets backoff],
812   [enable
813
814 # First connection attempt fails after 1000 ms.
815 run
816 connecting
817 run
818 timeout
819 run
820 connect-failed
821
822 # Back off for 1000 ms.
823 timeout
824 run
825
826 # Second connection attempt fails after 1000 ms.
827 connecting
828 timeout
829 run
830 connect-failed
831
832 # Back off for 2000 ms.
833 timeout
834 run
835
836 # Third connection attempt succeeds after 500 ms.
837 connecting
838 advance 500
839 run
840 connected
841
842 # Connection receives 3 chunks of data spaced 2000 ms apart.
843 advance 2000
844 run
845 received
846 advance 2000
847 run
848 received
849 advance 2000
850 run
851 received
852
853 # Connection drops.
854 disconnected
855 run
856
857 # Back off for 1000 ms.
858 timeout
859 run
860 ],
861   [### t=1000 ###
862 enable
863   in BACKOFF for 0 ms (0 ms backoff)
864
865 # First connection attempt fails after 1000 ms.
866 run
867   should connect
868 connecting
869   in CONNECT_IN_PROGRESS for 0 ms (0 ms backoff)
870 run
871 timeout
872   advance 1000 ms
873
874 ### t=2000 ###
875   in CONNECT_IN_PROGRESS for 1000 ms (0 ms backoff)
876 run
877   should disconnect
878 connect-failed
879   in BACKOFF for 0 ms (1000 ms backoff)
880   0 successful connections out of 1 attempts, seqno 0
881
882 # Back off for 1000 ms.
883 timeout
884   advance 1000 ms
885
886 ### t=3000 ###
887   in BACKOFF for 1000 ms (1000 ms backoff)
888 run
889   should connect
890
891 # Second connection attempt fails after 1000 ms.
892 connecting
893   in CONNECT_IN_PROGRESS for 0 ms (1000 ms backoff)
894 timeout
895   advance 1000 ms
896
897 ### t=4000 ###
898   in CONNECT_IN_PROGRESS for 1000 ms (1000 ms backoff)
899 run
900   should disconnect
901 connect-failed
902   in BACKOFF for 0 ms (2000 ms backoff)
903   0 successful connections out of 2 attempts, seqno 0
904
905 # Back off for 2000 ms.
906 timeout
907   advance 2000 ms
908
909 ### t=6000 ###
910   in BACKOFF for 2000 ms (2000 ms backoff)
911 run
912   should connect
913
914 # Third connection attempt succeeds after 500 ms.
915 connecting
916   in CONNECT_IN_PROGRESS for 0 ms (2000 ms backoff)
917 advance 500
918
919 ### t=6500 ###
920   in CONNECT_IN_PROGRESS for 500 ms (2000 ms backoff)
921 run
922 connected
923   in ACTIVE for 0 ms (2000 ms backoff)
924   created 1000, last received 1000, last connected 6500
925   1 successful connections out of 3 attempts, seqno 1
926   connected (0 ms), total 0 ms connected
927
928 # Connection receives 3 chunks of data spaced 2000 ms apart.
929 advance 2000
930
931 ### t=8500 ###
932   in ACTIVE for 2000 ms (2000 ms backoff)
933   connected (2000 ms), total 2000 ms connected
934 run
935 received
936   created 1000, last received 8500, last connected 6500
937 advance 2000
938
939 ### t=10500 ###
940   in ACTIVE for 4000 ms (2000 ms backoff)
941   connected (4000 ms), total 4000 ms connected
942 run
943 received
944   created 1000, last received 10500, last connected 6500
945 advance 2000
946
947 ### t=12500 ###
948   in ACTIVE for 6000 ms (2000 ms backoff)
949   connected (6000 ms), total 6000 ms connected
950 run
951 received
952   created 1000, last received 12500, last connected 6500
953
954 # Connection drops.
955 disconnected
956   in BACKOFF for 0 ms (1000 ms backoff)
957   1 successful connections out of 3 attempts, seqno 2
958   not connected (0 ms), total 6000 ms connected
959 run
960
961 # Back off for 1000 ms.
962 timeout
963   advance 1000 ms
964
965 ### t=13500 ###
966   in BACKOFF for 1000 ms (1000 ms backoff)
967 run
968   should connect
969 ])
970
971 ######################################################################
972 RECONNECT_CHECK([connection attempt fails quickly],
973   [enable
974
975 # Connection fails quickly.
976 run
977 connect-failed ECONNREFUSED
978
979 # Back off for 1000 ms.
980 run
981 timeout
982
983 # Connection fails quickly again.
984 run
985 connect-failed ECONNREFUSED
986
987 # Back off for 2000 ms.
988 run
989 timeout
990 ],
991    [### t=1000 ###
992 enable
993   in BACKOFF for 0 ms (0 ms backoff)
994
995 # Connection fails quickly.
996 run
997   should connect
998 connect-failed ECONNREFUSED
999   in BACKOFF for 0 ms (1000 ms backoff)
1000   0 successful connections out of 1 attempts, seqno 0
1001
1002 # Back off for 1000 ms.
1003 run
1004 timeout
1005   advance 1000 ms
1006
1007 ### t=2000 ###
1008   in BACKOFF for 1000 ms (1000 ms backoff)
1009
1010 # Connection fails quickly again.
1011 run
1012   should connect
1013 connect-failed ECONNREFUSED
1014   in BACKOFF for 0 ms (2000 ms backoff)
1015   0 successful connections out of 2 attempts, seqno 0
1016
1017 # Back off for 2000 ms.
1018 run
1019 timeout
1020   advance 2000 ms
1021
1022 ### t=4000 ###
1023   in BACKOFF for 2000 ms (2000 ms backoff)
1024 ])
1025
1026 ######################################################################
1027 RECONNECT_CHECK([max-tries of 1 honored],
1028   [set-max-tries 1
1029 enable
1030
1031 # Connection succeeds.
1032 run
1033 connected
1034
1035 # Send inactivity probe.
1036 timeout
1037 run
1038
1039 # Idle timeout kills connection.
1040 timeout
1041 run
1042 disconnected
1043 ],
1044   [### t=1000 ###
1045 set-max-tries 1
1046   1 tries left
1047 enable
1048   in BACKOFF for 0 ms (0 ms backoff)
1049   0 tries left
1050
1051 # Connection succeeds.
1052 run
1053   should connect
1054 connected
1055   in ACTIVE for 0 ms (0 ms backoff)
1056   1 successful connections out of 1 attempts, seqno 1
1057   connected (0 ms), total 0 ms connected
1058
1059 # Send inactivity probe.
1060 timeout
1061   advance 5000 ms
1062
1063 ### t=6000 ###
1064   in ACTIVE for 5000 ms (0 ms backoff)
1065   connected (5000 ms), total 5000 ms connected
1066 run
1067   should send probe
1068   in IDLE for 0 ms (0 ms backoff)
1069
1070 # Idle timeout kills connection.
1071 timeout
1072   advance 5000 ms
1073
1074 ### t=11000 ###
1075   in IDLE for 5000 ms (0 ms backoff)
1076   connected (10000 ms), total 10000 ms connected
1077 run
1078   should disconnect
1079 disconnected
1080   in VOID for 0 ms (1000 ms backoff)
1081   1 successful connections out of 1 attempts, seqno 2
1082   not connected (0 ms), total 10000 ms connected
1083 ])
1084
1085 ######################################################################
1086 RECONNECT_CHECK([max-tries of 0 honored],
1087   [set-max-tries 0
1088 enable
1089 run
1090 timeout
1091 ],
1092   [### t=1000 ###
1093 set-max-tries 0
1094   0 tries left
1095 enable
1096 run
1097 timeout
1098   no timeout
1099 ])
1100
1101 ######################################################################
1102 RECONNECT_CHECK([passive mode],
1103   [passive
1104 enable
1105
1106 # Start listening.
1107 timeout
1108 run
1109 listening
1110
1111 # Listening never times out.
1112 timeout
1113 run
1114
1115 # Listening failed (accept() returned funny error?).  Back off and try again.
1116 listen-error 0
1117 timeout
1118 run
1119 listening
1120
1121 # Connection accepted.
1122 connected
1123 received
1124 advance 1000
1125 received
1126
1127 # Connection times out.
1128 timeout
1129 run
1130 timeout
1131 run
1132 disconnected
1133
1134 # Start listening again.
1135 timeout
1136 run
1137 listening
1138 ],
1139   [### t=1000 ###
1140 passive
1141 enable
1142   in BACKOFF for 0 ms (0 ms backoff)
1143
1144 # Start listening.
1145 timeout
1146   advance 0 ms
1147 run
1148   should connect
1149 listening
1150   in LISTENING for 0 ms (0 ms backoff)
1151
1152 # Listening never times out.
1153 timeout
1154   no timeout
1155 run
1156
1157 # Listening failed (accept() returned funny error?).  Back off and try again.
1158 listen-error 0
1159   in BACKOFF for 0 ms (1000 ms backoff)
1160 timeout
1161   advance 1000 ms
1162
1163 ### t=2000 ###
1164   in BACKOFF for 1000 ms (1000 ms backoff)
1165 run
1166   should connect
1167 listening
1168   in LISTENING for 0 ms (1000 ms backoff)
1169
1170 # Connection accepted.
1171 connected
1172   in ACTIVE for 0 ms (1000 ms backoff)
1173   created 1000, last received 1000, last connected 2000
1174   1 successful connections out of 1 attempts, seqno 1
1175   connected (0 ms), total 0 ms connected
1176 received
1177   created 1000, last received 2000, last connected 2000
1178 advance 1000
1179
1180 ### t=3000 ###
1181   in ACTIVE for 1000 ms (1000 ms backoff)
1182   connected (1000 ms), total 1000 ms connected
1183 received
1184   created 1000, last received 3000, last connected 2000
1185
1186 # Connection times out.
1187 timeout
1188   advance 5000 ms
1189
1190 ### t=8000 ###
1191   in ACTIVE for 6000 ms (1000 ms backoff)
1192   connected (6000 ms), total 6000 ms connected
1193 run
1194   should send probe
1195   in IDLE for 0 ms (1000 ms backoff)
1196 timeout
1197   advance 5000 ms
1198
1199 ### t=13000 ###
1200   in IDLE for 5000 ms (1000 ms backoff)
1201   connected (11000 ms), total 11000 ms connected
1202 run
1203   should disconnect
1204 disconnected
1205   in BACKOFF for 0 ms (0 ms backoff)
1206   1 successful connections out of 1 attempts, seqno 2
1207   not connected (0 ms), total 11000 ms connected
1208
1209 # Start listening again.
1210 timeout
1211   advance 0 ms
1212 run
1213   should connect
1214 listening
1215   in LISTENING for 0 ms (0 ms backoff)
1216 ])