Validate port sets

Allocate ports, both statically specified and dynamically allocated, in discrete sets.  If any individual allocation fails then the entire allocation fails without any effects. 

This addresses issue #57 and issue #59.  It also fixes potential race/deadlock issues with container allocation related to port allocation.

I had updated another comment instead.  Fixed.

On Tue, Oct 14, 2014 at 3:51 PM, Peter Bourgon <notifications@github.com>
wrote:

> In harpoon-agent/ports.go:
>
> > @@ -6,122 +6,267 @@ import (
> >  	"net"
> >  )
> >
> > -// portRange manages a range of ports.
> > -type portRange struct {
> > -	startPort uint16 // inclusive
> > -	endPort   uint16 // inclusive
> > -	port      uint16 // this will be the next port returned by nextPort
> > -	ports     map[uint16]struct{}
> > +// portDB manages all ports, both statically and dynamically allocated.
> > +//
> > +// It is provides thread safety and atomic operations.  All ports are claimed, acquired,
>
> I don't see a change?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/soundcloud/harpoon/pull/89/files#r18829109>.
>



-- 
- Jeff Younker - jmy@soundcloud.com - +49 (0) 171 5641365 -