Skip to content

Commit

Permalink
ClientConn - avoid readThread() trying accessing an invalid channel
Browse files Browse the repository at this point in the history
  • Loading branch information
dudidaabulP81 committed Jun 6, 2022
1 parent 41b373c commit 51b894d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clientConn.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type ClientConn struct {
func (c *ClientConn) Close() error {
c.lock.Lock()
defer c.lock.Unlock()
close(c.responseChan)
c.lastError = io.ErrClosedPipe

return c.conn.Close()
Expand Down Expand Up @@ -174,6 +173,8 @@ func (c *ClientConn) UnregisterEvent(name string) (err error) {
}

func (c *ClientConn) readThread() {
defer close(c.responseChan)

for {
outMsg, err := readSegment(c.conn)
if err != nil {
Expand Down

0 comments on commit 51b894d

Please sign in to comment.