summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/tylerb/graceful
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/tylerb/graceful')
-rw-r--r--vendor/github.com/tylerb/graceful/graceful.go7
-rw-r--r--vendor/github.com/tylerb/graceful/signal.go17
-rw-r--r--vendor/github.com/tylerb/graceful/signal_appengine.go13
3 files changed, 32 insertions, 5 deletions
diff --git a/vendor/github.com/tylerb/graceful/graceful.go b/vendor/github.com/tylerb/graceful/graceful.go
index a5e2395e0..07c990489 100644
--- a/vendor/github.com/tylerb/graceful/graceful.go
+++ b/vendor/github.com/tylerb/graceful/graceful.go
@@ -6,9 +6,7 @@ import (
"net"
"net/http"
"os"
- "os/signal"
"sync"
- "syscall"
"time"
)
@@ -299,7 +297,7 @@ func (srv *Server) Serve(listener net.Listener) error {
interrupt := srv.interruptChan()
// Set up the interrupt handler
if !srv.NoSignalHandling {
- signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
+ signalNotify(interrupt)
}
quitting := make(chan struct{})
go srv.handleInterrupt(interrupt, quitting, listener)
@@ -336,8 +334,7 @@ func (srv *Server) Stop(timeout time.Duration) {
defer srv.stopLock.Unlock()
srv.Timeout = timeout
- interrupt := srv.interruptChan()
- interrupt <- syscall.SIGINT
+ sendSignalInt(srv.interruptChan())
}
// StopChan gets the stop channel which will block until
diff --git a/vendor/github.com/tylerb/graceful/signal.go b/vendor/github.com/tylerb/graceful/signal.go
new file mode 100644
index 000000000..9550978fe
--- /dev/null
+++ b/vendor/github.com/tylerb/graceful/signal.go
@@ -0,0 +1,17 @@
+//+build !appengine
+
+package graceful
+
+import (
+ "os"
+ "os/signal"
+ "syscall"
+)
+
+func signalNotify(interrupt chan<- os.Signal) {
+ signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
+}
+
+func sendSignalInt(interrupt chan<- os.Signal) {
+ interrupt <- syscall.SIGINT
+}
diff --git a/vendor/github.com/tylerb/graceful/signal_appengine.go b/vendor/github.com/tylerb/graceful/signal_appengine.go
new file mode 100644
index 000000000..6b776f087
--- /dev/null
+++ b/vendor/github.com/tylerb/graceful/signal_appengine.go
@@ -0,0 +1,13 @@
+//+build appengine
+
+package graceful
+
+import "os"
+
+func signalNotify(interrupt chan<- os.Signal) {
+ // Does not notify in the case of AppEngine.
+}
+
+func sendSignalInt(interrupt chan<- os.Signal) {
+ // Does not send in the case of AppEngine.
+}