Skip to content

Commit

Permalink
fix hb
Browse files Browse the repository at this point in the history
  • Loading branch information
snail007 committed Feb 6, 2025
1 parent 36835f9 commit 7fb5512
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion util/func/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func CheckError3(v1 interface{}, v2 interface{}, err error) (*gvalue.AnyValue, *
}

func Wait(f func()) <-chan error {
ch := make(chan error)
ch := make(chan error, 1)
go func() {
ch <- SafetyCall(f)
}()
Expand Down
8 changes: 4 additions & 4 deletions util/net/heartbeat_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (s *HeartbeatCodec) tempDelay(tempDelay time.Duration) time.Duration {
return tempDelay
}
func (s *HeartbeatCodec) heartbeat() {
done := make(chan error)
done := make(chan error, 1)
tempDelay := time.Duration(0)
p := gpool.New(1)
defer p.Stop()
Expand Down Expand Up @@ -195,7 +195,7 @@ retry:
func (s *HeartbeatCodec) backgroundRead() {
tempDelay := time.Duration(0)
msg := newHeartbeatCodecMsg()
out := make(chan error)
out := make(chan error, 1)
p := gpool.New(1)
defer p.Stop()
retry:
Expand Down Expand Up @@ -235,7 +235,7 @@ func (s *HeartbeatCodec) SetConn(c net.Conn) Codec {
}

func (s *HeartbeatCodec) Read(b []byte) (n int, err error) {
done := make(chan bool)
done := make(chan bool, 1)
s.readPool.Submit(func() {
defer close(done)
n, err = s.bufReader.Read(b)
Expand All @@ -252,7 +252,7 @@ func (s *HeartbeatCodec) Write(b []byte) (n int, err error) {
defer s.Unlock()
msg := newHeartbeatCodecMsg()
msg.SetData(b)
done := make(chan bool)
done := make(chan bool, 1)
p := s.writePool
if len(b) == 0 {
p = s.writeHbPool
Expand Down

0 comments on commit 7fb5512

Please sign in to comment.