|
|
@@ -34,10 +34,10 @@ func (r *Relay) Process(eastConn, westConn io.ReadWriteCloser) error {
|
|
34
|
34
|
westConn.Close()
|
|
35
|
35
|
}()
|
|
36
|
36
|
|
|
37
|
|
- go r.runObserver(r.ctx)
|
|
38
|
|
-
|
|
39
|
37
|
wg := &sync.WaitGroup{}
|
|
40
|
|
- wg.Add(2) // nolint: gomnd
|
|
|
38
|
+ wg.Add(3) // nolint: gomnd
|
|
|
39
|
+
|
|
|
40
|
+ go r.runObserver(r.ctx, wg)
|
|
41
|
41
|
|
|
42
|
42
|
go r.transmit(eastConn, westConn, r.westBuffer, "west", wg)
|
|
43
|
43
|
|
|
|
@@ -72,7 +72,7 @@ func (r *Relay) transmit(src io.ReadCloser, dst io.WriteCloser,
|
|
72
|
72
|
}
|
|
73
|
73
|
}
|
|
74
|
74
|
|
|
75
|
|
-func (r *Relay) runObserver(ctx context.Context) {
|
|
|
75
|
+func (r *Relay) runObserver(ctx context.Context, wg *sync.WaitGroup) {
|
|
76
|
76
|
ticker := time.NewTicker(time.Second)
|
|
77
|
77
|
|
|
78
|
78
|
defer func() {
|
|
|
@@ -82,6 +82,8 @@ func (r *Relay) runObserver(ctx context.Context) {
|
|
82
|
82
|
case <-ticker.C:
|
|
83
|
83
|
default:
|
|
84
|
84
|
}
|
|
|
85
|
+
|
|
|
86
|
+ wg.Done()
|
|
85
|
87
|
}()
|
|
86
|
88
|
|
|
87
|
89
|
lastTickAt := time.Now()
|