AsperforMias commented on code in PR #3833:
URL: https://github.com/apache/dubbo-go/pull/3833#discussion_r4601654387


##########
remoting/getty/listener.go:
##########
@@ -363,3 +362,84 @@ func heartbeat(session getty.Session, timeout 
time.Duration, callBack func(err e
 
        return perrors.WithStack(err)
 }
+
+// releaseSession cancels the session-scoped context and drops the session
+// from the map. It is safe to call more than once.
+func (h *RpcServerHandler) releaseSession(session getty.Session) {
+       h.rwlock.Lock()
+       rs := h.sessionMap[session]
+       delete(h.sessionMap, session)
+       h.rwlock.Unlock()
+       if rs != nil && rs.cancel != nil {
+               rs.cancel()
+       }
+}
+
+// cancelAll cancels every session context, used when the server stops.
+func (h *RpcServerHandler) cancelAll() {
+       h.rwlock.Lock()
+       cancels := make([]context.CancelFunc, 0, len(h.sessionMap))
+       for session, rs := range h.sessionMap {

Review Comment:
   done



##########
remoting/getty/listener.go:
##########
@@ -272,6 +272,9 @@ func (h *RpcServerHandler) OnMessage(session getty.Session, 
pkg any) {
        attachments[constant.LocalAddr] = session.LocalAddr()
        attachments[constant.RemoteAddr] = session.RemoteAddr()
 
+       reqCancel := h.bindRequestContext(session, invoc)

Review Comment:
   done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to