Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #319 from markdryan/master
Browse files Browse the repository at this point in the history
3rd party: Unvendor github.com/tylerb/graceful
  • Loading branch information
mcastelino authored Jun 27, 2016
2 parents f616228 + fd051a7 commit aa1d0e3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 574 deletions.
5 changes: 0 additions & 5 deletions ciao-vendor/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@
"version": "67139b9",
"license": "Apache v2.0"
},
"github.com/tylerb/graceful": {
"url": "https://github.com/tylerb/graceful.git",
"version": "9a3d423",
"license": "MIT"
},
"github.com/vishvananda/netlink": {
"url": "https://github.com/vishvananda/netlink.git",
"version": "293adec",
Expand Down
30 changes: 18 additions & 12 deletions networking/libsnnet/docker_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
ipamapi "github.com/docker/libnetwork/ipams/remote/api"
"github.com/golang/glog"
"github.com/gorilla/mux"
"github.com/tylerb/graceful"
)

/*
Expand Down Expand Up @@ -194,9 +193,11 @@ type DockerPlugin struct {
//This is needed as the Docker Daemon and ciao have
//different life cycles and UUIDs
*mux.Router
*graceful.Server
*http.Server
DockerEpMap
DockerNwMap
wg sync.WaitGroup
listener net.Listener
}

func sendResponse(resp interface{}, w http.ResponseWriter) {
Expand Down Expand Up @@ -792,22 +793,24 @@ func (d *DockerPlugin) Init() error {
// The DockerPlugin has to be started prior to the launch of the
// Docker Daemon
func (d *DockerPlugin) Start() error {
var err error
d.listener, err = net.Listen("tcp", DockerPluginCfg.Addr)
if err != nil {
return fmt.Errorf("Unable to create listener: %v\n", err)
}

d.Server = &graceful.Server{
Timeout: DockerPluginCfg.Timeout,

Server: &http.Server{
Addr: DockerPluginCfg.Addr,
Handler: d.Router,
},
d.Server = &http.Server{
Handler: d.Router,
}

d.wg.Add(1)
go func() {
glog.Infof("Starting HTTP Server")
err := d.Server.ListenAndServe()
err := d.Server.Serve(d.listener)
if err != nil {
glog.Errorf("Unable to start HTTP Server [%v]", err)
}
d.wg.Done()
}()
return nil
}
Expand All @@ -819,8 +822,11 @@ func (d *DockerPlugin) Start() error {
//retry mechanism. Hence if the docker plugin is restarted
//within the retry windows, the docker APIs will still succeed
func (d *DockerPlugin) Stop() error {
//TODO: To be implemented
d.Server.Stop(DockerPluginCfg.Timeout)
if err := d.listener.Close(); err != nil {
return fmt.Errorf("Unable to shutdown http server: %v", err)
}
d.wg.Wait()
glog.Info("Docker plugin has shut down")
return nil
}

Expand Down
21 changes: 0 additions & 21 deletions vendor/github.com/tylerb/graceful/LICENSE

This file was deleted.

137 changes: 0 additions & 137 deletions vendor/github.com/tylerb/graceful/README.md

This file was deleted.

Loading

0 comments on commit aa1d0e3

Please sign in to comment.