|
|
@@ -4,7 +4,6 @@ import (
|
|
4
|
4
|
"bytes"
|
|
5
|
5
|
"context"
|
|
6
|
6
|
"io"
|
|
7
|
|
- "sync"
|
|
8
|
7
|
|
|
9
|
8
|
"github.com/9seconds/mtg/v2/essentials"
|
|
10
|
9
|
)
|
|
|
@@ -40,22 +39,15 @@ func (c connTraffic) Write(b []byte) (int, error) {
|
|
40
|
39
|
type connRewind struct {
|
|
41
|
40
|
essentials.Conn
|
|
42
|
41
|
|
|
43
|
|
- active io.Reader
|
|
44
|
42
|
buf bytes.Buffer
|
|
45
|
|
- mutex sync.RWMutex
|
|
|
43
|
+ active io.Reader
|
|
46
|
44
|
}
|
|
47
|
45
|
|
|
48
|
46
|
func (c *connRewind) Read(p []byte) (int, error) {
|
|
49
|
|
- c.mutex.RLock()
|
|
50
|
|
- defer c.mutex.RUnlock()
|
|
51
|
|
-
|
|
52
|
|
- return c.active.Read(p) //nolint: wrapcheck
|
|
|
47
|
+ return c.active.Read(p)
|
|
53
|
48
|
}
|
|
54
|
49
|
|
|
55
|
50
|
func (c *connRewind) Rewind() {
|
|
56
|
|
- c.mutex.Lock()
|
|
57
|
|
- defer c.mutex.Unlock()
|
|
58
|
|
-
|
|
59
|
51
|
c.active = io.MultiReader(&c.buf, c.Conn)
|
|
60
|
52
|
}
|
|
61
|
53
|
|