File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
14
14
// This handler is compatible with io.Writer.
15
15
type Conn struct {
16
16
c net.Conn
17
+ br * bufio.Reader
17
18
bw * bufio.Writer
18
19
19
20
input chan * Frame
@@ -92,6 +93,7 @@ func (c *Conn) reset(conn net.Conn) {
92
93
c .MaxPayloadSize = DefaultPayloadSize
93
94
c .userValues = make (map [string ]interface {})
94
95
c .c = conn
96
+ c .br = bufio .NewReader (conn )
95
97
c .bw = bufio .NewWriter (conn )
96
98
}
97
99
@@ -105,7 +107,7 @@ func (c *Conn) readLoop() {
105
107
// if c.ReadTimeout != 0 {
106
108
// }
107
109
108
- _ , err := fr .ReadFrom (c .c )
110
+ _ , err := fr .ReadFrom (c .br )
109
111
if err != nil {
110
112
select {
111
113
case c .errch <- closeError {err : err }:
Original file line number Diff line number Diff line change @@ -194,6 +194,12 @@ func (s *Server) Upgrade(ctx *fasthttp.RequestCtx) {
194
194
})
195
195
196
196
ctx .Hijack (func (c net.Conn ) {
197
+ if nc , ok := c .(interface {
198
+ UnsafeConn () net.Conn
199
+ }); ok {
200
+ c = nc .UnsafeConn ()
201
+ }
202
+
197
203
conn := acquireConn (c )
198
204
conn .id = atomic .AddUint64 (& s .nextID , 1 )
199
205
// establishing default options
You can’t perform that action at this time.
0 commit comments