Closed chinaerserver closed 4 years ago
cc @watermelo @fangyincheng . pls check it.
I am worried about that in handleLoop() function if using writer encode pkg fail ,why still loop and doing nothing? Why not panic to stop for-looping
I am worried about that in handleLoop() function if using writer encode pkg fail ,why still loop and doing nothing? Why not panic to stop for-looping
I also want to know why?
in handleLoop() function select case <-s.done: branch
counter.Start() if counter.Count() > s.wait.Nanoseconds() { log.Info("%s, [session.handleLoop] got done signal ", s.Stat()) break LOOP }
if counter doesn't reach session exit waiting time , this if-branch will not hit so it cannot break loop. however close(s. done) will tigger only once, if for-loop continue running ,case <-s.done will never reach. so exit wait delay will not perform as expected.
In my opinion, judging exit waiting timeout should appear in select default case or using while counter.Count() > s.wait.Nanoseconds() {} to confirm timeout exit as expected.