This commit is contained in:
11
rpc-pool.go
11
rpc-pool.go
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -33,9 +34,6 @@ type RemoteGrain struct {
|
||||
}
|
||||
|
||||
func NewRemoteGrain(id CartId, address string) *RemoteGrain {
|
||||
if !strings.Contains(address, ":") {
|
||||
address = fmt.Sprintf("[%s]:1337", address)
|
||||
}
|
||||
return &RemoteGrain{
|
||||
Id: id,
|
||||
Address: address,
|
||||
@@ -44,7 +42,12 @@ func NewRemoteGrain(id CartId, address string) *RemoteGrain {
|
||||
|
||||
func (g *RemoteGrain) Connect() error {
|
||||
if g.connection == nil {
|
||||
client, err := net.Dial("tcp", g.Address)
|
||||
addr := g.Address
|
||||
if !strings.Contains(addr, ":") {
|
||||
addr = fmt.Sprintf("%s:1337", addr)
|
||||
}
|
||||
log.Println("Connecting to", addr)
|
||||
client, err := net.Dial("tcp", addr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user