Kaynağa Gözat

Always close connection on context finished

tags/v2.0.0-rc1
9seconds 5 yıl önce
ebeveyn
işleme
80a1de60e6
1 değiştirilmiş dosya ile 5 ekleme ve 0 silme
  1. 5
    0
      mtglib/proxy.go

+ 5
- 0
mtglib/proxy.go Dosyayı Görüntüle

29
 	ctx := newStreamContext(p.ctx, p.logger, conn)
29
 	ctx := newStreamContext(p.ctx, p.logger, conn)
30
 	defer ctx.Close()
30
 	defer ctx.Close()
31
 
31
 
32
+	go func() {
33
+		<-ctx.Done()
34
+		ctx.Close()
35
+	}()
36
+
32
 	p.eventStream.Send(ctx, EventStart{
37
 	p.eventStream.Send(ctx, EventStart{
33
 		CreatedAt: time.Now(),
38
 		CreatedAt: time.Now(),
34
 		ConnID:    ctx.connID,
39
 		ConnID:    ctx.connID,

Loading…
İptal
Kaydet