log who owns it
This commit is contained in:
@@ -18,7 +18,6 @@ const CurrentPacketVersion = 2
|
|||||||
type CartListener map[CartId]Listener
|
type CartListener map[CartId]Listener
|
||||||
|
|
||||||
func NewCartPacketQueue(connection *PersistentConnection) *CartPacketQueue {
|
func NewCartPacketQueue(connection *PersistentConnection) *CartPacketQueue {
|
||||||
|
|
||||||
queue := &CartPacketQueue{
|
queue := &CartPacketQueue{
|
||||||
expectedPackages: make(map[CartMessage]*CartListener),
|
expectedPackages: make(map[CartMessage]*CartListener),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ func (p *SyncedPool) RemoveRemoteGrain(id CartId) {
|
|||||||
|
|
||||||
func (p *SyncedPool) SpawnRemoteGrain(id CartId, host string) {
|
func (p *SyncedPool) SpawnRemoteGrain(id CartId, host string) {
|
||||||
if p.local.grains[id] != nil {
|
if p.local.grains[id] != nil {
|
||||||
log.Printf("Grain %s already exists locally, deleting\n", id)
|
log.Printf("Grain %s already exists locally, exists on (%s)\n", id, host)
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
delete(p.local.grains, id)
|
delete(p.local.grains, id)
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
@@ -395,18 +395,15 @@ func (p *SyncedPool) AddRemote(host string) error {
|
|||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
for range time.Tick(time.Second * 3) {
|
for range time.Tick(time.Second * 3) {
|
||||||
var err error
|
err := remote.Ping()
|
||||||
|
|
||||||
err = remote.Ping()
|
for err != nil {
|
||||||
if err != nil {
|
time.Sleep(time.Millisecond * 200)
|
||||||
for err != nil {
|
err = remote.Ping()
|
||||||
time.Sleep(time.Millisecond * 200)
|
if remote.MissedPings > 3 {
|
||||||
err = remote.Ping()
|
log.Printf("Removing host, unable to communicate with %s", host)
|
||||||
if remote.MissedPings > 3 {
|
p.RemoveHost(&remote)
|
||||||
log.Printf("Removing host, unable to communicate with %s", host)
|
return
|
||||||
p.RemoveHost(&remote)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user