18 lines
479 B
Go
18 lines
479 B
Go
package app
|
|
|
|
func allocateTransportSlots(items []TransportClient) (string, int) {
|
|
usedMarks := map[uint64]struct{}{}
|
|
usedPrefs := map[int]struct{}{}
|
|
for _, it := range items {
|
|
if n, ok := parseTransportMarkHex(it.MarkHex); ok {
|
|
usedMarks[n] = struct{}{}
|
|
}
|
|
if p, ok := parseTransportPref(it.PriorityBase); ok {
|
|
usedPrefs[p] = struct{}{}
|
|
}
|
|
}
|
|
mark := nextTransportMark(usedMarks)
|
|
pref := nextTransportPref(usedPrefs)
|
|
return formatTransportMarkHex(mark), pref
|
|
}
|