222twotwotwo commented on code in PR #138:
URL: https://github.com/apache/dubbo-getty/pull/138#discussion_r3642738151
##########
server.go:
##########
@@ -421,11 +422,29 @@ func (s *server) runWSEventLoop(newSession
NewSessionCallback) {
s.lock.Unlock()
err = server.Serve(s.streamListener)
if err != nil {
- log.Errorf("http.server.Serve(addr{%s}) = err:%+v",
s.addr, perrors.WithStack(err))
+ if isHTTPServeCloseError(err) {
+ s.logHTTPServeClose(err)
+ } else {
+ s.logHTTPServeError(err)
+ }
}
}()
}
+func (s *server) logHTTPServeClose(err error) {
+ log.Infof("http.server.Serve(addr{%s}) closed: %v", s.addr, err)
+}
+
+func isHTTPServeCloseError(err error) bool {
+ return errors.Is(err, http.ErrServerClosed) ||
+ errors.Is(err, net.ErrClosed) ||
+ strings.Contains(err.Error(), "use of closed network
connection")
Review Comment:
收到,已去除该文本匹配
##########
server_test.go:
##########
@@ -226,6 +226,30 @@ func TestWSServeWSRequestClosesSelfConnectConn(t
*testing.T) {
}
}
+func TestWSSServerCloseDoesNotPanic(t *testing.T) {
+ certFile := filepath.Join(t.TempDir(), "server.crt")
+ keyFile := filepath.Join(t.TempDir(), "server.key")
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]