Skip to content

Commit

Permalink
Merge pull request #4918 from oiooj/master
Browse files Browse the repository at this point in the history
Fix restore functionality hangs forever
  • Loading branch information
otoolep committed Nov 30, 2015
2 parents 8901125 + f144820 commit abf8fb7
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions meta/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"path/filepath"
"sort"
"strconv"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -735,12 +734,12 @@ func (s *Store) serveExecListener() {
// Accept next TCP connection.
var err error
conn, err := s.ExecListener.Accept()
if err != nil {
if strings.Contains(err.Error(), "connection closed") {
return
}
s.Logger.Printf("temporary accept error: %s", err)
if opErr, ok := err.(*net.OpError); ok && opErr.Temporary() {
s.Logger.Printf("exec listener temporary accept error: %s", err)
continue
} else if err != nil {
s.Logger.Printf("exec listener accept error and closed: %s", err)
return
}

// Handle connection in a separate goroutine.
Expand Down Expand Up @@ -845,13 +844,12 @@ func (s *Store) serveRPCListener() {
for {
// Accept next TCP connection.
conn, err := s.RPCListener.Accept()
if err != nil {
if strings.Contains(err.Error(), "connection closed") {
return
}

s.Logger.Printf("temporary accept error: %s", err)
if opErr, ok := err.(*net.OpError); ok && opErr.Temporary() {
s.Logger.Printf("RPC listener temporary accept error: %s", err)
continue
} else if err != nil {
s.Logger.Printf("RPC listener accept error and closed: %s", err)
return
}

// Handle connection in a separate goroutine.
Expand Down

0 comments on commit abf8fb7

Please sign in to comment.