Use unix-socket as communication channel

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Conflicts:
	ctr/container.go
This commit is contained in:
Alexander Morozov 2015-12-14 15:54:11 -08:00 committed by Michael Crosby
parent e16dfc36a5
commit ca4191ce41
6 changed files with 47 additions and 21 deletions

View file

@ -5,6 +5,7 @@ package main
import (
"flag"
"net"
"strconv"
"sync"
"time"
@ -17,19 +18,26 @@ import (
func init() {
flag.StringVar(&bundle, "bundle", "/containers/redis", "the bundle path")
flag.StringVar(&addr, "addr", "/run/containerd/containerd.sock", "address to the container d instance")
flag.IntVar(&count, "count", 1000, "number of containers to run")
flag.Parse()
}
var (
count int
bundle string
group = sync.WaitGroup{}
jobs = make(chan string, 20)
count int
bundle, addr string
group = sync.WaitGroup{}
jobs = make(chan string, 20)
)
func getClient() types.APIClient {
conn, err := grpc.Dial("localhost:8888", grpc.WithInsecure())
dialOpts := []grpc.DialOption{grpc.WithInsecure()}
dialOpts = append(dialOpts,
grpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("unix", addr, timeout)
},
))
conn, err := grpc.Dial(addr, dialOpts...)
if err != nil {
logrus.Fatal(err)
}