You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/01/12 11:06:27 UTC
[GitHub] [dubbo-getty] AlexStocks commented on a change in pull request #92: Fix: fix connection was assigned a nil will lead to panic
AlexStocks commented on a change in pull request #92:
URL: https://github.com/apache/dubbo-getty/pull/92#discussion_r782959708
##########
File path: session.go
##########
@@ -873,3 +870,132 @@ func (s *session) Close() {
s.stop()
log.Infof("%s closed now. its current gr num is %d", s.sessionToken(), s.grNum.Load())
}
+
+// GetActive return connection's time
+func (s *session) GetActive() time.Time {
+ if s == nil {
+ return launchTime
+ }
+ s.lock.RLock()
+ defer s.lock.RUnlock()
+ if s.Connection != nil {
+ return s.Connection.GetActive()
+ }
+ return launchTime
+}
+
+// UpdateActive update connection's active time
+func (s *session) UpdateActive() {
+ if s == nil {
+ return
+ }
+ s.lock.RLock()
+ if s.Connection != nil {
+ s.Connection.UpdateActive()
+ }
+ s.lock.RUnlock()
Review comment:
你说你们有多无聊,在这里争论 defer 性能,defer 性能现在优化的很好了
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org