Change the type of entry.Free to address.Count

This change is backward compatible, because the underlying types of
address.Offset (the previous type) and address.Count are the same
and the Gob encoder does not require types to exactly correspond.
This commit is contained in:
Martynas Pumputis committed 2016-05-16 15:03:05 +01:00
1 parent ef5f80a05a
commit 85cea672d3
3 files changed
+12 -13

No files matched your search

+2 -3
View File
@@ -14,8 +14,7 @@ type entry struct {
Token address.Address // The start of this range
Peer mesh.PeerName // Who owns this range
Version uint32 // Version of this range
Free address.Offset // Number of free IPs in this range
// Note: Free should perhaps be an address.Count, but we can't change the wire protocol
Free address.Count // Number of free IPs in this range
}
func (e *entry) Equal(e2 *entry) bool {
@@ -23,7 +22,7 @@ func (e *entry) Equal(e2 *entry) bool {
e.Version == e2.Version
}
func (e *entry) update(peername mesh.PeerName, free address.Offset) {
func (e *entry) update(peername mesh.PeerName, free address.Count) {
e.Peer = peername
e.Version++
e.Free = free