AlexStocks commented on code in PR #3645:
URL: https://github.com/apache/dubbo-go/pull/3645#discussion_r3788484595
##########
protocol/triple/triple_protocol/server.go:
##########
@@ -264,6 +270,28 @@ func (s *Server) startHttp2AndHttp3(tlsConf *tls.Config)
error {
return err
}
+ if len(tlsConf.Certificates) == 0 &&
+ tlsConf.GetCertificate == nil &&
+ tlsConf.GetConfigForClient == nil {
+ return fmt.Errorf("TRIPLE HTTP/2 and HTTP/3 Server must have a
TLS certificate configured, but none of
Certificates/GetCertificate/GetConfigForClient is set")
+ }
+
+ // Pre-bind the TCP (HTTP/2) listener before serving any request:
+ // fail fast with the bind error when the port is occupied.
+ tcpLn, err := netListen("tcp", s.addr)
+ if err != nil {
+ return fmt.Errorf("HTTP/2 server bind error: %w", err)
+ }
+ defer tcpLn.Close()
+
Review Comment:
[P1] 双协议路径增加了第二个 epoch 检查,但单协议路径仍保留同一竞态窗口
Run() 只在第 207 行检查一次 epoch。HTTP/2 随后才在 startHttp2() 第 225 行保存 httpSrv;HTTP/3
还会先构造 QUIC 配置,到第 260 行才保存 http3Srv。如果 Stop() 落在入口检查之后、对应 Store 之前,它递增 epoch
时看到的两个 server 指针仍为 nil,会返回成功;启动协程随后继续 ListenAndServe。双协议路径第 339
行的第二次检查已覆盖该窗口,但两个单协议分支没有。请让单协议分支也在发布 server 后、监听前复核 epoch,或用统一生命周期状态覆盖
checkpoint 到 Store,并分别补充这一时序的 HTTP/2、HTTP/3 测试。
--
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]