fix(observer): add nil guards, fix resource leak, silent event drops, and missing doc comments
- WrapUDPConn, WrapPacketConn, WrapListener: add nil guards for pc/ln params - NewGRPCPlugin: return no-op observer instead of nil on connection error - gRPC plugin: fix resource leak by wiring Close() through observerWrapper and service.Close() lifecycle - Both plugins: log unknown event types instead of silently dropping them - httpPlugin: remove dead nil check for always-non-nil client field - Stats.Reset: update core interface doc to match implementation behavior - Add doc comments to all exported symbols across the observer package
This commit is contained in:
@@ -302,6 +302,11 @@ func (s *defaultService) Close() error {
|
||||
if closer, ok := s.handler.(io.Closer); ok {
|
||||
closer.Close()
|
||||
}
|
||||
if s.options.observer != nil {
|
||||
if closer, ok := s.options.observer.(io.Closer); ok {
|
||||
closer.Close()
|
||||
}
|
||||
}
|
||||
return s.listener.Close()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user