minor fix - logs for incrementing number of attempts

This commit is contained in:
crn4 2025-06-17 18:05:52 +02:00
parent c43ddddcdb
commit 641891e931

View File

@ -43,21 +43,18 @@ func (l *loginFilter) addLogin(wgPubKey, metaHash string) {
hashes: make(map[string]struct{}, loggingLimit), hashes: make(map[string]struct{}, loggingLimit),
start: time.Now(), start: time.Now(),
} }
l.logged[wgPubKey] = mh
} }
mh.hashes[metaHash] = struct{}{} mh.hashes[metaHash] = struct{}{}
mh.counter++ mh.counter++
l.logged[wgPubKey] = mh if mh.counter >= loggingLimit && mh.counter%loggingLimit == 0 && len(mh.hashes) > 1 {
if mh.counter > loggingLimit && len(mh.hashes) > 1 {
log.WithFields(log.Fields{ log.WithFields(log.Fields{
"wgPubKey": wgPubKey, "wgPubKey": wgPubKey,
"number of different hashes": len(mh.hashes), "number of different hashes": len(mh.hashes),
"elapsed time for number of attempts": time.Since(mh.start), "elapsed time for number of attempts": time.Since(mh.start),
"number of syncs": mh.counter, "number of syncs": mh.counter,
}).Info(mh.prepareHashes()) }).Info(mh.prepareHashes())
delete(l.logged, wgPubKey)
} }
l.logged[wgPubKey] = mh
} }
func (m *metahash) prepareHashes() string { func (m *metahash) prepareHashes() string {