| ... | ... |
@@ -74,19 +74,19 @@ func removePidFile(pidfile string) {
|
| 74 | 74 |
} |
| 75 | 75 |
|
| 76 | 76 |
func daemon(pidfile string) error {
|
| 77 |
- if err := createPidFile(pidfile); err != nil {
|
|
| 78 |
- log.Fatal(err) |
|
| 79 |
- } |
|
| 80 |
- defer removePidFile(pidfile) |
|
| 77 |
+ if err := createPidFile(pidfile); err != nil {
|
|
| 78 |
+ log.Fatal(err) |
|
| 79 |
+ } |
|
| 80 |
+ defer removePidFile(pidfile) |
|
| 81 | 81 |
|
| 82 |
- c := make(chan os.Signal, 1) |
|
| 83 |
- signal.Notify(c, os.Interrupt, os.Kill, os.Signal(syscall.SIGTERM)) |
|
| 84 |
- go func() {
|
|
| 85 |
- sig := <-c |
|
| 86 |
- log.Printf("Received signal '%v', exiting\n", sig)
|
|
| 87 |
- removePidFile(pidfile) |
|
| 88 |
- os.Exit(0) |
|
| 89 |
- }() |
|
| 82 |
+ c := make(chan os.Signal, 1) |
|
| 83 |
+ signal.Notify(c, os.Interrupt, os.Kill, os.Signal(syscall.SIGTERM)) |
|
| 84 |
+ go func() {
|
|
| 85 |
+ sig := <-c |
|
| 86 |
+ log.Printf("Received signal '%v', exiting\n", sig)
|
|
| 87 |
+ removePidFile(pidfile) |
|
| 88 |
+ os.Exit(0) |
|
| 89 |
+ }() |
|
| 90 | 90 |
|
| 91 | 91 |
service, err := docker.NewServer() |
| 92 | 92 |
if err != nil {
|
| ... | ... |
@@ -293,7 +293,7 @@ func (alloc *PortAllocator) Acquire(port int) (int, error) {
|
| 293 | 293 |
|
| 294 | 294 |
func newPortAllocator() (*PortAllocator, error) {
|
| 295 | 295 |
allocator := &PortAllocator{
|
| 296 |
- inUse: make(map[int]struct{}),
|
|
| 296 |
+ inUse: make(map[int]struct{}),
|
|
| 297 | 297 |
fountain: make(chan int), |
| 298 | 298 |
} |
| 299 | 299 |
go allocator.runFountain() |