20 lines
299 B
Go
20 lines
299 B
Go
package peer
|
|
|
|
const DUP_LIST_SIZE = 32
|
|
|
|
type dupList struct {
|
|
items [DUP_LIST_SIZE]uint64
|
|
index int
|
|
}
|
|
|
|
func (l *dupList) isDuplicate(in uint64) bool {
|
|
for _, i := range l.items {
|
|
if i == in {
|
|
return true
|
|
}
|
|
}
|
|
l.items[l.index] = in
|
|
l.index = (l.index + 1) % DUP_LIST_SIZE
|
|
return false
|
|
}
|