connect if not connected
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m53s

This commit is contained in:
matst80
2024-11-09 23:40:04 +01:00
parent 52e9a44238
commit 3feaa61248

View File

@@ -52,7 +52,11 @@ func (g *RemoteGrain) Connect() error {
}
func (g *RemoteGrain) HandleMessage(message *Message, isReplay bool) ([]byte, error) {
err := SendCartPacket(g.connection, g.Id, RemoteHandleMessage, message.Write)
err := g.Connect()
if err != nil {
return nil, err
}
err = SendCartPacket(g.connection, g.Id, RemoteHandleMessage, message.Write)
if err != nil {
return nil, err
}
@@ -68,7 +72,11 @@ func (g *RemoteGrain) GetId() CartId {
}
func (g *RemoteGrain) GetCurrentState() ([]byte, error) {
err := SendCartPacket(g.connection, g.Id, RemoteGetState, func(w io.Writer) error {
err := g.Connect()
if err != nil {
return nil, err
}
err = SendCartPacket(g.connection, g.Id, RemoteGetState, func(w io.Writer) error {
return nil
})
if err != nil {