Guillaume J. Charmes 12 年之前
父節點
當前提交
22893429ed
共有 2 個文件被更改,包括 13 次插入13 次删除
  1. 12 12
      docker/docker.go
  2. 1 1
      network.go

+ 12 - 12
docker/docker.go

@@ -74,19 +74,19 @@ func removePidFile(pidfile string) {
 }
 
 func daemon(pidfile string) error {
-		if err := createPidFile(pidfile); err != nil {
-			log.Fatal(err)
-		}
-		defer removePidFile(pidfile)
+	if err := createPidFile(pidfile); err != nil {
+		log.Fatal(err)
+	}
+	defer removePidFile(pidfile)
 
-		c := make(chan os.Signal, 1)
-		signal.Notify(c, os.Interrupt, os.Kill, os.Signal(syscall.SIGTERM))
-		go func() {
-			sig := <-c
-			log.Printf("Received signal '%v', exiting\n", sig)
-			removePidFile(pidfile)
-			os.Exit(0)
-		}()
+	c := make(chan os.Signal, 1)
+	signal.Notify(c, os.Interrupt, os.Kill, os.Signal(syscall.SIGTERM))
+	go func() {
+		sig := <-c
+		log.Printf("Received signal '%v', exiting\n", sig)
+		removePidFile(pidfile)
+		os.Exit(0)
+	}()
 
 	service, err := docker.NewServer()
 	if err != nil {

+ 1 - 1
network.go

@@ -293,7 +293,7 @@ func (alloc *PortAllocator) Acquire(port int) (int, error) {
 
 func newPortAllocator() (*PortAllocator, error) {
 	allocator := &PortAllocator{
-		inUse: make(map[int]struct{}),
+		inUse:    make(map[int]struct{}),
 		fountain: make(chan int),
 	}
 	go allocator.runFountain()