mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-23 08:40:18 +01:00
Support unix domain sockets.
This commit is contained in:
parent
349906c622
commit
ba2dd15280
@ -12,6 +12,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
@ -117,7 +118,14 @@ func main() {
|
||||
|
||||
var listener net.Listener
|
||||
|
||||
listener, err = net.Listen("tcp", fmt.Sprintf("%s:%d", host, port))
|
||||
var proto, address string
|
||||
if strings.ContainsRune(host, '/') {
|
||||
proto, address = "unix", host
|
||||
} else {
|
||||
proto, address = "tcp", fmt.Sprintf("%s:%d", host, port)
|
||||
}
|
||||
|
||||
listener, err = net.Listen(proto, address)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
@ -59,9 +60,17 @@ func createBaseLevel(
|
||||
jobs := make(chan blockPos)
|
||||
var done sync.WaitGroup
|
||||
|
||||
var proto string
|
||||
if strings.ContainsRune(address, '/') {
|
||||
proto = "unix"
|
||||
} else {
|
||||
proto = "tcp"
|
||||
}
|
||||
|
||||
for i := 0; i < numWorkers; i++ {
|
||||
var client *common.RedisClient
|
||||
if client, err = common.NewRedisClient("tcp", address); err != nil {
|
||||
|
||||
if client, err = common.NewRedisClient(proto, address); err != nil {
|
||||
return
|
||||
}
|
||||
done.Add(1)
|
||||
|
Loading…
Reference in New Issue
Block a user