We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a5ecad7 commit 8c54bd9Copy full SHA for 8c54bd9
netconn.go
@@ -7,6 +7,7 @@ import (
7
"io"
8
"math"
9
"net"
10
+ "sync"
11
"sync/atomic"
12
"time"
13
)
@@ -69,8 +70,9 @@ type netConn struct {
69
70
71
readTimer *time.Timer
72
readContext context.Context
- eofed bool
73
74
+ readMu sync.Mutex
75
+ eofed bool
76
reader io.Reader
77
}
78
@@ -89,6 +91,9 @@ func (c *netConn) Write(p []byte) (int, error) {
89
91
90
92
93
func (c *netConn) Read(p []byte) (int, error) {
94
+ c.readMu.Lock()
95
+ defer c.readMu.Unlock()
96
+
97
if c.eofed {
98
return 0, io.EOF
99
0 commit comments