Browse Source

Handle "AcceptEx" as error op on windows

Yasuhiro Matsumoto 11 years ago
parent
commit
a2ec7ac683
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      graceful/graceful.go

+ 6
- 1
graceful/graceful.go View File

@ -9,6 +9,7 @@ package graceful
import ( import (
"net" "net"
"runtime"
"sync/atomic" "sync/atomic"
"github.com/zenazn/goji/graceful/listener" "github.com/zenazn/goji/graceful/listener"
@ -49,7 +50,11 @@ func peacefulError(err error) error {
// Unfortunately Go doesn't really give us a better way to select errors // Unfortunately Go doesn't really give us a better way to select errors
// than this, so *shrug*. // than this, so *shrug*.
if oe, ok := err.(*net.OpError); ok { if oe, ok := err.(*net.OpError); ok {
if oe.Op == "accept" && oe.Err.Error() == errClosing {
errOp := "accept"
if runtime.GOOS == "windows" {
errOp = "AcceptEx"
}
if oe.Op == errOp && oe.Err.Error() == errClosing {
return nil return nil
} }
} }


Loading…
Cancel
Save