change stuff
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 27s
Build and Publish / BuildAndDeploy (push) Successful in 2m23s

This commit is contained in:
matst80
2024-11-13 22:52:36 +01:00
parent 4d3e49b53d
commit 0a0fd1738c
4 changed files with 21 additions and 12 deletions

View File

@@ -103,7 +103,7 @@ func (p *SyncedPool) GrainOwnerChangeHandler(data *FrameWithPayload, resultChan
idAndHostParts := strings.Split(string(data.Payload), ";")
if len(idAndHostParts) != 2 {
log.Printf("Invalid remote grain change message\n")
resultChan <- MakeFrameWithPayload(AckError, 400, []byte("invalid"))
resultChan <- MakeFrameWithPayload(AckError, 500, []byte("invalid"))
return nil
}
id := ToCartId(idAndHostParts[0])
@@ -360,17 +360,17 @@ func (p *SyncedPool) removeLocalGrain(id CartId) {
delete(p.local.grains, id)
}
func (p *SyncedPool) AddRemote(host string) error {
func (p *SyncedPool) AddRemote(host string) {
_, hasHost := p.remotes[host]
if host == "" || p.IsKnown(host) || hasHost {
return nil
if host == "" || hasHost {
return
}
client := NewConnection(fmt.Sprintf("%s:1338", host))
_, err := client.Call(Ping, nil)
if err != nil {
log.Printf("Error connecting to remote %s: %s\n", host, err)
return err
return
}
remote := RemoteHost{
@@ -403,7 +403,7 @@ func (p *SyncedPool) AddRemote(host string) error {
log.Printf("Added remote %s\n", remote.Host)
go remote.Initialize(p)
return nil
return
}
func (p *SyncedPool) getGrain(id CartId) (Grain, error) {