[WIP] fix getNextAvailableAddress to use local maximums instead of just last a...

...ddress

@dallasmarlow @joshrabinowitz @Primer42 @maddalab Comments/reviews welcome. This intends to fix IP allocation when not using pools. Old behavior would just allocate the next address, regardless of if a lower address was free. It would fail to allocate if you had a range 0..20 and IPs 18,19,20 were in use :(

Ive tested this for edgecases, and believe it is working correctly. However, I would love comments. I have a sneaking suspicion I could do this slickly with a for comprehension, but it escapes me. 


If I use a SortedSet, this doesnt work, as apply() on a SortedSet is a boolean (contains). I suppose though there isnt a need for a sorted set though, so Ill use your solution with normal lists that are sorted by the DB.

O(n) is better than O(nlog(n)) :)