package notify import "sync" type recordRuntime struct { mu sync.RWMutex handler func(RecordAcceptInfo) error } func newRecordRuntime() *recordRuntime { return &recordRuntime{} } func (r *recordRuntime) setHandler(fn func(RecordAcceptInfo) error) { if r == nil { return } r.mu.Lock() r.handler = fn r.mu.Unlock() } func (r *recordRuntime) handlerSnapshot() func(RecordAcceptInfo) error { if r == nil { return nil } r.mu.RLock() defer r.mu.RUnlock() return r.handler } func (c *ClientCommon) getRecordRuntime() *recordRuntime { if c == nil { return nil } return c.recordRuntime } func (s *ServerCommon) getRecordRuntime() *recordRuntime { if s == nil { return nil } return s.recordRuntime }