Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Commit

Permalink
don't overwrite addr of unix proto if non-empty
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Grennan <[email protected]>
  • Loading branch information
tgrennan committed Jun 7, 2016
1 parent 340ca98 commit d92dd30
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import (

type Server struct {
sync.Mutex
Proto string
Addr string // TCP address to listen on, ":6389" if empty
Proto string // default, "tcp"
Addr string // default,
// if Proto == unix then "/tmp/redis.sock" else ":6389"
MonitorChans []chan string
methods map[string]HandlerFn
listener net.Listener
Expand All @@ -28,10 +29,12 @@ func (srv *Server) listen() error {
if srv.Proto == "" {
srv.Proto = "tcp"
}
if srv.Proto == "unix" && addr == "" {
addr = "/tmp/redis.sock"
} else if addr == "" {
addr = ":6389"
if addr == "" {
if srv.Proto == "unix" {
addr = "/tmp/redis.sock"
} else {
addr = ":6389"
}
}
l, e := net.Listen(srv.Proto, addr)
if e != nil {
Expand Down

0 comments on commit d92dd30

Please sign in to comment.