@cryptotaxi247 / kubo / commits / 8ef61e770

fix(routingd) listen for interrupts

Brian Tiger Chow committed Feb 6, 2015 at 11:43 UTC 8ef61e7704084b381c80aea2842b1daab4287b6f
1 file changed +5 -4
cmd/ipfs_routingd/main.go
+5 -4
@@ -4,6 +4,7 @@ import (
4 "flag"
5 "log"
6 "os"
7 + "os/signal"
8
9 context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
10 aws "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/crowdmob/goamz/aws"
@@ -11,7 +12,6 @@ import (
12 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
13 syncds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
14 core "github.com/jbenet/go-ipfs/core"
14 - corehttp "github.com/jbenet/go-ipfs/core/corehttp"
15 corerouting "github.com/jbenet/go-ipfs/core/corerouting"
16 config "github.com/jbenet/go-ipfs/repo/config"
17 fsrepo "github.com/jbenet/go-ipfs/repo/fsrepo"
@@ -20,7 +20,6 @@ import (
20 )
21
22 var (
23 - host = flag.String("host", "/ip4/0.0.0.0/tcp/4001", "override the host listening address")
23 s3bucket = flag.String("aws-bucket", "", "S3 bucket for routing datastore")
24 s3region = flag.String("aws-region", aws.USWest2.Name, "S3 region")
25 nBitsForKeypair = flag.Int("b", 1024, "number of bits for keypair (if repo is uninitialized)")
@@ -76,8 +75,10 @@ func run() error {
75 }
76 defer node.Close()
77
79 - opts := []corehttp.ServeOption{}
80 - return corehttp.ListenAndServe(node, *host, opts...) // TODO rm
78 + interrupt := make(chan os.Signal)
79 + signal.Notify(interrupt, os.Kill, os.Interrupt)
80 + <-interrupt
81 + return nil
82 }
83
84 func makeS3Datastore() (*s3datastore.S3Datastore, error) {