Commit 69cc8c6f authored by georgehao's avatar georgehao

feat: change sessionTimerLoop to heartbeat

parent 0f8af9de
...@@ -453,7 +453,7 @@ func (s *session) WriteBytesArray(pkgs ...[]byte) (int, error) { ...@@ -453,7 +453,7 @@ func (s *session) WriteBytesArray(pkgs ...[]byte) (int, error) {
return wlg, nil return wlg, nil
} }
func sessionTimerLoop(_ gxtime.TimerID, _ time.Time, arg interface{}) error { func heartbeat(_ gxtime.TimerID, _ time.Time, arg interface{}) error {
ss, _ := arg.(*session) ss, _ := arg.(*session)
if ss == nil || ss.IsClosed() { if ss == nil || ss.IsClosed() {
return ErrSessionClosed return ErrSessionClosed
...@@ -498,7 +498,7 @@ func (s *session) run() { ...@@ -498,7 +498,7 @@ func (s *session) run() {
} }
s.grNum.Add(1) s.grNum.Add(1)
if _, err := defaultTimerWheel.AddTimer(sessionTimerLoop, gxtime.TimerLoop, s.period, s); err != nil { if _, err := defaultTimerWheel.AddTimer(heartbeat, gxtime.TimerLoop, s.period, s); err != nil {
panic(fmt.Sprintf("failed to add session %s to defaultTimerWheel err:%v", s.Stat(), err)) panic(fmt.Sprintf("failed to add session %s to defaultTimerWheel err:%v", s.Stat(), err))
} }
// start read gr // start read gr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment