Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes for weekly.2012-02-22.

  • Loading branch information...
commit 38b9a0bf112631cf38d2b50524e96264ec47244e 1 parent d3bce22
Aram Hăvărneanu authored
Showing with 23 additions and 22 deletions.
  1. +2 −1  peer/peer.go
  2. +3 −3 server/server.go
  3. +12 −12 server/txn.go
  4. +6 −6 store/node.go
View
3  peer/peer.go
@@ -12,6 +12,7 @@ import (
"log"
"net"
"os"
+ "syscall"
"time"
)
@@ -187,7 +188,7 @@ func Main(clusterName, self, buri, rwsk, rosk string, cl *doozer.Conn, udpConn *
buf := make([]byte, maxUDPLen)
n, addr, err := udpConn.ReadFromUDP(buf)
- if err == os.EINVAL {
+ if err == syscall.EINVAL {
return
}
if err != nil {
View
6 server/server.go
@@ -5,7 +5,7 @@ import (
"github.com/ha/doozerd/store"
"log"
"net"
- "os"
+ "syscall"
)
// ListenAndServe listens on l, accepts network connections, and
@@ -15,10 +15,10 @@ func ListenAndServe(l net.Listener, canWrite chan bool, st *store.Store, p conse
for {
c, err := l.Accept()
if err != nil {
- if err == os.EINVAL {
+ if err == syscall.EINVAL {
break
}
- if e, ok := err.(*net.OpError); ok && e.Err == os.EINVAL {
+ if e, ok := err.(*net.OpError); ok && e.Err == syscall.EINVAL {
break
}
log.Println(err)
View
24 server/txn.go
@@ -6,8 +6,8 @@ import (
"github.com/ha/doozerd/store"
"io"
"log"
- "os"
"sort"
+ "syscall"
)
type txn struct {
@@ -48,7 +48,7 @@ func (t *txn) run() {
func (t *txn) get() {
if !t.c.raccess {
- t.respondOsError(os.EACCES)
+ t.respondOsError(syscall.EACCES)
return
}
@@ -80,7 +80,7 @@ func (t *txn) get() {
func (t *txn) set() {
if !t.c.waccess {
- t.respondOsError(os.EACCES)
+ t.respondOsError(syscall.EACCES)
return
}
@@ -107,7 +107,7 @@ func (t *txn) set() {
func (t *txn) del() {
if !t.c.waccess {
- t.respondOsError(os.EACCES)
+ t.respondOsError(syscall.EACCES)
return
}
@@ -133,7 +133,7 @@ func (t *txn) del() {
func (t *txn) nop() {
if !t.c.waccess {
- t.respondOsError(os.EACCES)
+ t.respondOsError(syscall.EACCES)
return
}
@@ -156,7 +156,7 @@ func (t *txn) rev() {
func (t *txn) stat() {
if !t.c.raccess {
- t.respondOsError(os.EACCES)
+ t.respondOsError(syscall.EACCES)
return
}
@@ -176,7 +176,7 @@ func (t *txn) stat() {
func (t *txn) getdir() {
if !t.c.raccess {
- t.respondOsError(os.EACCES)
+ t.respondOsError(syscall.EACCES)
return
}
@@ -216,7 +216,7 @@ func (t *txn) getdir() {
func (t *txn) wait() {
if !t.c.raccess {
- t.respondOsError(os.EACCES)
+ t.respondOsError(syscall.EACCES)
return
}
@@ -256,7 +256,7 @@ func (t *txn) wait() {
func (t *txn) walk() {
if !t.c.raccess {
- t.respondOsError(os.EACCES)
+ t.respondOsError(syscall.EACCES)
return
}
@@ -306,7 +306,7 @@ func (t *txn) access() {
if t.c.grant(string(t.req.Value)) {
t.respond()
} else {
- t.respondOsError(os.EACCES)
+ t.respondOsError(syscall.EACCES)
}
}
@@ -318,9 +318,9 @@ func (t *txn) respondOsError(err error) {
t.respondErrCode(response_REV_MISMATCH)
case store.ErrTooLate:
t.respondErrCode(response_TOO_LATE)
- case os.EISDIR:
+ case syscall.EISDIR:
t.respondErrCode(response_ISDIR)
- case os.ENOTDIR:
+ case syscall.ENOTDIR:
t.respondErrCode(response_NOTDIR)
default:
t.resp.ErrDetail = proto.String(err.Error())
View
12 store/node.go
@@ -1,7 +1,7 @@
package store
import (
- "os"
+ "syscall"
)
var emptyDir = node{V: "", Ds: make(map[string]node), Rev: Dir}
@@ -41,14 +41,14 @@ func (n node) at(parts []string) (node, error) {
return m.at(parts[1:])
}
}
- return node{}, os.ENOENT
+ return node{}, syscall.ENOENT
}
panic("unreachable")
}
func (n node) get(parts []string) ([]string, int64) {
switch m, err := n.at(parts); err {
- case os.ENOENT:
+ case syscall.ENOENT:
return []string{""}, Missing
default:
if len(m.Ds) > 0 {
@@ -66,7 +66,7 @@ func (n node) Get(path string) ([]string, int64) {
func (n node) stat(parts []string) (int32, int64) {
switch m, err := n.at(parts); err {
- case os.ENOENT:
+ case syscall.ENOENT:
return 0, Missing
default:
l := len(m.Ds)
@@ -143,7 +143,7 @@ func (n node) apply(seqn int64, mut string) (rep node, ev Event) {
break
}
if dirRev != Dir {
- ev.Err = os.ENOTDIR
+ ev.Err = syscall.ENOTDIR
break
}
}
@@ -154,7 +154,7 @@ func (n node) apply(seqn int64, mut string) (rep node, ev Event) {
if rev != Clobber && rev < curRev {
ev.Err = ErrRevMismatch
} else if curRev == Dir {
- ev.Err = os.EISDIR
+ ev.Err = syscall.EISDIR
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.