| 1 | package agent |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | |
| 6 | "reasonix/internal/extension" |
| 7 | ) |
| 8 | |
| 9 | // trackPublishedHostStream binds cancel to the context's runtime owner so a |
| 10 | // session rebuild can drain its own HTTP streams without touching siblings. |
| 11 | func trackPublishedHostStream(ctx context.Context, cancel context.CancelFunc) (untrack func()) { |
| 12 | owner := extension.RuntimeOwnerFromContext(ctx) |
| 13 | gen := owner.Gate.Published() |
| 14 | if gen == 0 || cancel == nil { |
| 15 | return func() {} |
| 16 | } |
| 17 | return owner.HostStreams.Track(gen, cancel) |
| 18 | } |
| 19 |