Alanxtl commented on code in PR #3749:
URL: https://github.com/apache/dubbo-go/pull/3749#discussion_r4091007853


##########
protocol/triple/triple_protocol/duplex_http_call.go:
##########
@@ -125,6 +123,17 @@ func (d *duplexHTTPCall) Write(data []byte) (int, error) {
        return bytesWritten, err
 }
 
+// checkBeforeWrite checks cancellation without starting a live request, so
+// buffered writes can keep request headers mutable until their first flush.
+func (d *duplexHTTPCall) checkBeforeWrite() error {
+       if err := d.ctx.Err(); err != nil {
+               d.ensureRequestMade()
+               d.SetError(err)
+               return wrapIfContextError(err)
+       }
+       return nil
+}
+

Review Comment:
   这个函数为啥要抽出来



-- 
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