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"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||||
@ -117,7 +118,14 @@ func main() {
|
|||||||
|
|
||||||
var listener net.Listener
|
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 {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||||
@ -59,9 +60,17 @@ func createBaseLevel(
|
|||||||
jobs := make(chan blockPos)
|
jobs := make(chan blockPos)
|
||||||
var done sync.WaitGroup
|
var done sync.WaitGroup
|
||||||
|
|
||||||
|
var proto string
|
||||||
|
if strings.ContainsRune(address, '/') {
|
||||||
|
proto = "unix"
|
||||||
|
} else {
|
||||||
|
proto = "tcp"
|
||||||
|
}
|
||||||
|
|
||||||
for i := 0; i < numWorkers; i++ {
|
for i := 0; i < numWorkers; i++ {
|
||||||
var client *common.RedisClient
|
var client *common.RedisClient
|
||||||
if client, err = common.NewRedisClient("tcp", address); err != nil {
|
|
||||||
|
if client, err = common.NewRedisClient(proto, address); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
done.Add(1)
|
done.Add(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user