The spec says:
A node obeying this specification must not send UDP datagrams with a payload larger than 1024 octets,
We need to calculate the maximum number of values we can put into the response so the total message size is <= 1024 bytes. Call this number N. If we have more than N peers, we should take only N of them, but we should randomize which N to pick.
Note that N depend on whether we are sending ipv4 or ipv6 contacts and also on the number of ipv4 and/or ipv6 nodes we include in the message.
The spec says:
We need to calculate the maximum number of
valueswe can put into the response so the total message size is <= 1024 bytes. Call this numberN. If we have more thanNpeers, we should take onlyNof them, but we should randomize whichNto pick.Note that
Ndepend on whether we are sending ipv4 or ipv6 contacts and also on the number of ipv4 and/or ipv6 nodes we include in the message.