mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-07-14 05:50:28 +02:00
Support unix domain sockets in redis clients, too.
This commit is contained in:
@ -11,6 +11,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"runtime/pprof"
|
||||
"strings"
|
||||
|
||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
)
|
||||
@ -84,11 +85,16 @@ func main() {
|
||||
colors.TransparentDim = common.Clamp32f(
|
||||
float32(transparentDim/100.0), 0.0, 100.0)
|
||||
|
||||
address := 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)
|
||||
}
|
||||
|
||||
var client *common.RedisClient
|
||||
|
||||
if client, err = common.NewRedisClient("tcp", address); err != nil {
|
||||
if client, err = common.NewRedisClient(proto, address); err != nil {
|
||||
log.Fatalf("Cannot connect to '%s': %s", address, err)
|
||||
}
|
||||
defer client.Close()
|
||||
|
Reference in New Issue
Block a user