client: imp code

This commit is contained in:
Stanislav Chzhen 2024-04-01 17:20:15 +03:00
parent 548a15c000
commit 025c29bcd2
2 changed files with 6 additions and 6 deletions

View File

@ -146,8 +146,8 @@ func (r *Runtime) SetWHOIS(info *whois.Info) {
r.whois = info
}
// Unset clears a cs information.
func (r *Runtime) Unset(cs Source) {
// unset clears a cs information.
func (r *Runtime) unset(cs Source) {
switch cs {
case SourceWHOIS:
r.whois = nil
@ -162,8 +162,8 @@ func (r *Runtime) Unset(cs Source) {
}
}
// IsEmpty returns true if there is no information from any source.
func (r *Runtime) IsEmpty() (ok bool) {
// isEmpty returns true if there is no information from any source.
func (r *Runtime) isEmpty() (ok bool) {
return r.whois == nil &&
r.arp == nil &&
r.rdns == nil &&

View File

@ -51,9 +51,9 @@ func (ri *RuntimeIndex) Delete(ip netip.Addr) {
// the specified source and returns the number of removed clients.
func (ri *RuntimeIndex) DeleteBySource(src Source) (n int) {
for ip, rc := range ri.index {
rc.Unset(src)
rc.unset(src)
if rc.IsEmpty() {
if rc.isEmpty() {
delete(ri.index, ip)
n++
}