This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
|||||||
type RemoteGrainPool struct {
|
type RemoteGrainPool struct {
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
Host string
|
Host string
|
||||||
grains map[CartId]RemoteGrain
|
grains map[CartId]*RemoteGrain
|
||||||
}
|
}
|
||||||
|
|
||||||
func (id CartId) String() string {
|
func (id CartId) String() string {
|
||||||
@@ -99,7 +99,7 @@ func (g *RemoteGrain) GetCurrentState() ([]byte, error) {
|
|||||||
func NewRemoteGrainPool(addr string) *RemoteGrainPool {
|
func NewRemoteGrainPool(addr string) *RemoteGrainPool {
|
||||||
return &RemoteGrainPool{
|
return &RemoteGrainPool{
|
||||||
Host: addr,
|
Host: addr,
|
||||||
grains: make(map[CartId]RemoteGrain),
|
grains: make(map[CartId]*RemoteGrain),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ func (p *RemoteGrainPool) findRemoteGrain(id CartId) *RemoteGrain {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
grain.Connect()
|
grain.Connect()
|
||||||
return &grain
|
return grain
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *RemoteGrainPool) findOrCreateGrain(id CartId) *RemoteGrain {
|
func (p *RemoteGrainPool) findOrCreateGrain(id CartId) *RemoteGrain {
|
||||||
@@ -119,7 +119,7 @@ func (p *RemoteGrainPool) findOrCreateGrain(id CartId) *RemoteGrain {
|
|||||||
if grain == nil {
|
if grain == nil {
|
||||||
grain = NewRemoteGrain(id, p.Host)
|
grain = NewRemoteGrain(id, p.Host)
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
p.grains[id] = *grain
|
p.grains[id] = grain
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
grain.Connect()
|
grain.Connect()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user