Commit 37c6244
Look the SSLContext up from the SSL_CTX in the ALPN/NPN callbacks
ossl_sslctx_mark uses rb_gc_mark_movable, so the SSLContext relocates. Its VALUE
is stored in four places: the SSL_CTX's ex_data, and the callback argument of the
NPN advertise, NPN select and ALPN select callbacks. ossl_sslctx_compact updates
the first. Nothing updates the other three, so after a compaction they hold the
pre-move address.
The three callbacks all receive the SSL, and the SSL_CTX's ex_data copy is
already kept current -- so they can look the object up instead of carrying their
own copy, which leaves exactly one stored copy and one place to maintain.
Registration is one-shot (ossl_sslctx_setup returns early when self is frozen),
so the stale address is captured at the first handshake and never refreshed.
Fixes #1088.1 parent 80959f8 commit 37c6244
1 file changed
Lines changed: 15 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
582 | 590 | | |
583 | 591 | | |
584 | 592 | | |
585 | 593 | | |
586 | 594 | | |
587 | | - | |
| 595 | + | |
| 596 | + | |
588 | 597 | | |
589 | 598 | | |
590 | 599 | | |
| |||
598 | 607 | | |
599 | 608 | | |
600 | 609 | | |
601 | | - | |
| 610 | + | |
602 | 611 | | |
603 | 612 | | |
604 | 613 | | |
| |||
612 | 621 | | |
613 | 622 | | |
614 | 623 | | |
615 | | - | |
| 624 | + | |
616 | 625 | | |
617 | 626 | | |
618 | 627 | | |
| |||
807 | 816 | | |
808 | 817 | | |
809 | 818 | | |
810 | | - | |
| 819 | + | |
811 | 820 | | |
812 | 821 | | |
813 | 822 | | |
814 | | - | |
| 823 | + | |
815 | 824 | | |
816 | 825 | | |
817 | 826 | | |
| |||
827 | 836 | | |
828 | 837 | | |
829 | 838 | | |
830 | | - | |
| 839 | + | |
831 | 840 | | |
832 | 841 | | |
833 | 842 | | |
| |||
0 commit comments