Problem
Config.OnConnect and Config.OnDisconnect are called by epoll and io_uring engines but silently ignored by the std engine. The connStateHook only tracks activeConns.
Unblocks
Change
// engine/std/engine.go — connStateHook:
func (e *Engine) connStateHook(conn net.Conn, state http.ConnState) {
switch state {
case http.StateNew:
e.metrics.activeConns.Add(1)
if e.cfg.OnConnect != nil {
e.cfg.OnConnect(conn.RemoteAddr().String())
}
case http.StateClosed, http.StateHijacked:
e.metrics.activeConns.Add(-1)
if e.cfg.OnDisconnect != nil {
e.cfg.OnDisconnect(conn.RemoteAddr().String())
}
}
}
Performance
Two nil checks in connection-lifecycle code (not per-request). Branch prediction eliminates overhead when callbacks are nil.
Files
Problem
Config.OnConnectandConfig.OnDisconnectare called by epoll and io_uring engines but silently ignored by the std engine. TheconnStateHookonly tracksactiveConns.Unblocks
Change
Performance
Two nil checks in connection-lifecycle code (not per-request). Branch prediction eliminates overhead when callbacks are nil.
Files
engine/std/engine.go