From 61aafa98f878a21ce09e29410baa41f348f255f7 Mon Sep 17 00:00:00 2001 From: Naitik Shah Date: Sun, 6 Oct 2013 11:00:22 -0700 Subject: [PATCH] move inline interface out for readability --- grace.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/grace.go b/grace.go index a80fbb2..6abcbf3 100644 --- a/grace.go +++ b/grace.go @@ -51,6 +51,10 @@ type listener struct { wg sync.WaitGroup } +type deadliner interface { + SetDeadline(t time.Time) error +} + // Allows for us to notice when the connection is closed. type conn struct { net.Conn @@ -76,9 +80,7 @@ func (l *listener) Close() error { // Init provided sockets dont actually close so we trigger Accept to return // by setting the deadline. if os.Getppid() == 1 { - if ld, ok := l.Listener.(interface { - SetDeadline(t time.Time) error - }); ok { + if ld, ok := l.Listener.(deadliner); ok { ld.SetDeadline(timeInPast) } else { fmt.Fprintln(os.Stderr, "init activated server did not have SetDeadline")