Skip to content

Commit

Permalink
Merge pull request #20 from althen/master
Browse files Browse the repository at this point in the history
add mutex.Unlock()
  • Loading branch information
withlin authored Dec 28, 2018
2 parents 3bb2622 + 38010bc commit 4cfad66
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/simple_canal_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ func readHeaderLength() int {
//readNextPacket 通过长度去读取数据包
func readNextPacket() ([]byte,error) {
mutex.Lock()
defer func(){
mutex.Unlock()
}()
rdr := bufio.NewReader(conn)
data := make([]byte, 0, 4*1024)
n, err := io.ReadFull(rdr, data[:4])
Expand All @@ -437,7 +440,6 @@ func readNextPacket() ([]byte,error) {
return nil,err
}
data = data[:n]
mutex.Unlock()
return data,nil
}

Expand Down

0 comments on commit 4cfad66

Please sign in to comment.