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