Commit 3c6cf46d authored by pantianying's avatar pantianying Committed by watermelo

change variable name

parent 07467b31
...@@ -86,9 +86,9 @@ type session struct { ...@@ -86,9 +86,9 @@ type session struct {
// attribute // attribute
attrs *ValuesContext attrs *ValuesContext
// goroutines done signal // read goroutines done signal
handlePackageDone chan struct{} rDone chan struct{}
lock sync.RWMutex lock sync.RWMutex
} }
func newSession(endPoint EndPoint, conn Connection) *session { func newSession(endPoint EndPoint, conn Connection) *session {
...@@ -102,10 +102,10 @@ func newSession(endPoint EndPoint, conn Connection) *session { ...@@ -102,10 +102,10 @@ func newSession(endPoint EndPoint, conn Connection) *session {
period: period, period: period,
done: make(chan struct{}), done: make(chan struct{}),
wait: pendingDuration, wait: pendingDuration,
attrs: NewValuesContext(nil), attrs: NewValuesContext(nil),
handlePackageDone: make(chan struct{}), rDone: make(chan struct{}),
} }
ss.Connection.setSession(ss) ss.Connection.setSession(ss)
...@@ -146,7 +146,7 @@ func (s *session) Reset() { ...@@ -146,7 +146,7 @@ func (s *session) Reset() {
s.period = period s.period = period
s.wait = pendingDuration s.wait = pendingDuration
s.attrs = NewValuesContext(nil) s.attrs = NewValuesContext(nil)
s.handlePackageDone = make(chan struct{}) s.rDone = make(chan struct{})
s.SetWriteTimeout(netIOTimeout) s.SetWriteTimeout(netIOTimeout)
s.SetReadTimeout(netIOTimeout) s.SetReadTimeout(netIOTimeout)
...@@ -508,7 +508,7 @@ LOOP: ...@@ -508,7 +508,7 @@ LOOP:
select { select {
case <-s.done: case <-s.done:
// this case branch assure the (session)handleLoop gr will exit before (session)handlePackage gr. // this case branch assure the (session)handleLoop gr will exit before (session)handlePackage gr.
<-s.handlePackageDone <-s.rDone
if len(s.wQ) == 0 { if len(s.wQ) == 0 {
log.Infof("%s, [session.handleLoop] got done signal. wQ is nil.", s.Stat()) log.Infof("%s, [session.handleLoop] got done signal. wQ is nil.", s.Stat())
break LOOP break LOOP
...@@ -570,7 +570,7 @@ func (s *session) handlePackage() { ...@@ -570,7 +570,7 @@ func (s *session) handlePackage() {
log.Errorf("[session.handlePackage] panic session %s: err=%s\n%s", s.sessionToken(), r, rBuf) log.Errorf("[session.handlePackage] panic session %s: err=%s\n%s", s.sessionToken(), r, rBuf)
} }
close(s.handlePackageDone) close(s.rDone)
log.Infof("%s, [session.handlePackage] gr will exit now", s.sessionToken()) log.Infof("%s, [session.handlePackage] gr will exit now", s.sessionToken())
s.stop() s.stop()
if err != nil { if err != nil {
......
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