提交 8ef61e77 作者: Brian Tiger Chow

fix(routingd) listen for interrupts

上级 0a8e5b99
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"flag" "flag"
"log" "log"
"os" "os"
"os/signal"
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context" context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
aws "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/crowdmob/goamz/aws" aws "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/crowdmob/goamz/aws"
...@@ -11,7 +12,6 @@ import ( ...@@ -11,7 +12,6 @@ import (
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore" "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
syncds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync" syncds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
core "github.com/jbenet/go-ipfs/core" core "github.com/jbenet/go-ipfs/core"
corehttp "github.com/jbenet/go-ipfs/core/corehttp"
corerouting "github.com/jbenet/go-ipfs/core/corerouting" corerouting "github.com/jbenet/go-ipfs/core/corerouting"
config "github.com/jbenet/go-ipfs/repo/config" config "github.com/jbenet/go-ipfs/repo/config"
fsrepo "github.com/jbenet/go-ipfs/repo/fsrepo" fsrepo "github.com/jbenet/go-ipfs/repo/fsrepo"
...@@ -20,7 +20,6 @@ import ( ...@@ -20,7 +20,6 @@ import (
) )
var ( var (
host = flag.String("host", "/ip4/0.0.0.0/tcp/4001", "override the host listening address")
s3bucket = flag.String("aws-bucket", "", "S3 bucket for routing datastore") s3bucket = flag.String("aws-bucket", "", "S3 bucket for routing datastore")
s3region = flag.String("aws-region", aws.USWest2.Name, "S3 region") s3region = flag.String("aws-region", aws.USWest2.Name, "S3 region")
nBitsForKeypair = flag.Int("b", 1024, "number of bits for keypair (if repo is uninitialized)") nBitsForKeypair = flag.Int("b", 1024, "number of bits for keypair (if repo is uninitialized)")
...@@ -76,8 +75,10 @@ func run() error { ...@@ -76,8 +75,10 @@ func run() error {
} }
defer node.Close() defer node.Close()
opts := []corehttp.ServeOption{} interrupt := make(chan os.Signal)
return corehttp.ListenAndServe(node, *host, opts...) // TODO rm signal.Notify(interrupt, os.Kill, os.Interrupt)
<-interrupt
return nil
} }
func makeS3Datastore() (*s3datastore.S3Datastore, error) { func makeS3Datastore() (*s3datastore.S3Datastore, error) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论