Panics while decoding messages in connection.mainLoopRead would trigger more panics
This commit is contained in:
parent
cf022be396
commit
c4f5a49c97
|
@ -749,10 +749,15 @@ func (c *connection) mainReadLoop() error {
|
|||
Pool: t.chunkPool,
|
||||
}
|
||||
for {
|
||||
cl.mu.Unlock()
|
||||
var msg pp.Message
|
||||
err := decoder.Decode(&msg)
|
||||
cl.mu.Lock()
|
||||
var (
|
||||
msg pp.Message
|
||||
err error
|
||||
)
|
||||
func() {
|
||||
cl.mu.Unlock()
|
||||
defer cl.mu.Lock()
|
||||
err = decoder.Decode(&msg)
|
||||
}()
|
||||
if cl.closed.IsSet() || c.closed.IsSet() || err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue