You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2022/01/12 04:54:58 UTC
[dubbo-getty] branch master updated: Fix: taskPool will execute task when session was nil
This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-getty.git
The following commit(s) were added to refs/heads/master by this push:
new d25d2a8 Fix: taskPool will execute task when session was nil
new 292995d Merge pull request #91 from takewofly/bug/panic
d25d2a8 is described below
commit d25d2a84625a364f5eb046f1de3497b553d9fd22
Author: jason <lv...@gmail.com>
AuthorDate: Fri Jan 7 11:15:26 2022 +0800
Fix: taskPool will execute task when session was nil
---
session.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/session.go b/session.go
index 0db4f90..be225c2 100644
--- a/session.go
+++ b/session.go
@@ -565,6 +565,11 @@ func (s *session) run() {
func (s *session) addTask(pkg interface{}) {
f := func() {
+ s.lock.RLock()
+ defer s.lock.RUnlock()
+ if s.Connection == nil {
+ return
+ }
s.listener.OnMessage(s, pkg)
s.incReadPkgNum()
}