check if connection implements connectionStater when it should

This commit is contained in:
WeidiDeng 2025-04-28 16:52:49 +08:00
parent c537d9bc5c
commit ff4aae6098
No known key found for this signature in database
GPG Key ID: 25F87CE1741EC7CD

View File

@ -36,14 +36,11 @@ func (h *http2Listener) Accept() (net.Conn, error) {
return nil, err
}
if h.useTLS {
_, isConnectionStater := conn.(connectionStater)
// emit a warning
if _, ok := conn.(connectionStater); !ok {
if h.useTLS && !isConnectionStater {
h.logger.Warn("tls is enabled, but listener wrapper returns a connection that doesn't implement connectionStater")
}
}
if _, ok := conn.(connectionStater); ok {
} else if isConnectionStater {
h.logger.Warn("tls is disabled, but listener wrapper returns a connection that implements connectionStater")
}