refactor: add context propagation to connection and event systems

This commit is contained in:
adman
2026-04-29 23:38:24 +02:00
parent 159437c1ca
commit 96481da0a4
4 changed files with 21 additions and 8 deletions
+5 -1
View File
@@ -236,8 +236,12 @@ func (l *Loop) StartLoop() (err error) {
}
func NewLoop() (l *Loop) {
return NewLoopCtx(context.Background())
}
func NewLoopCtx(ctx context.Context) (l *Loop) {
l = &Loop{}
l.Ctx, l.Cancel = context.WithCancel(context.Background())
l.Ctx, l.Cancel = context.WithCancel(ctx)
l.HandlerFunctions = make(map[reflect.Type][]reflect.Value)
return
}