|
|
@ -1000,18 +1000,35 @@ func (ext *GQLExt) Process(ctx *Context, source NodeID, node *Node, signal Signa
|
|
|
|
sig := signal.(StringSignal)
|
|
|
|
sig := signal.(StringSignal)
|
|
|
|
switch sig.Str {
|
|
|
|
switch sig.Str {
|
|
|
|
case "start_server":
|
|
|
|
case "start_server":
|
|
|
|
|
|
|
|
if ext.State == "stopped" {
|
|
|
|
err := ext.StartGQLServer(ctx, node)
|
|
|
|
err := ext.StartGQLServer(ctx, node)
|
|
|
|
if err == nil {
|
|
|
|
if err == nil {
|
|
|
|
|
|
|
|
ext.State = "running"
|
|
|
|
ctx.Send(node.ID, source, StringSignal{NewDirectSignal(GQLStateSignalType), "server_started"})
|
|
|
|
ctx.Send(node.ID, source, StringSignal{NewDirectSignal(GQLStateSignalType), "server_started"})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
case "stop_server":
|
|
|
|
case "stop_server":
|
|
|
|
|
|
|
|
if ext.State == "running" {
|
|
|
|
err := ext.StopGQLServer()
|
|
|
|
err := ext.StopGQLServer()
|
|
|
|
if err == nil {
|
|
|
|
if err == nil {
|
|
|
|
|
|
|
|
ext.State = "stopped"
|
|
|
|
ctx.Send(node.ID, source, StringSignal{NewDirectSignal(GQLStateSignalType), "server_stopped"})
|
|
|
|
ctx.Send(node.ID, source, StringSignal{NewDirectSignal(GQLStateSignalType), "server_stopped"})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
ctx.Log.Logf("gql", "unknown gql state %s", sig.Str)
|
|
|
|
ctx.Log.Logf("gql", "unknown gql state %s", sig.Str)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if signal.Type() == StartSignalType {
|
|
|
|
|
|
|
|
switch ext.State {
|
|
|
|
|
|
|
|
case "running":
|
|
|
|
|
|
|
|
err := ext.StartGQLServer(ctx, node)
|
|
|
|
|
|
|
|
if err == nil {
|
|
|
|
|
|
|
|
ctx.Send(node.ID, source, StringSignal{NewDirectSignal(GQLStateSignalType), "server_started"})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case "stopped":
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
ctx.Log.Logf("gql", "unknown state to restore from: %s", ext.State)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1090,6 +1107,7 @@ func NewGQLExt(ctx *Context, listen string, tls_cert []byte, tls_key []byte, sta
|
|
|
|
tls_key = ssl_key_pem
|
|
|
|
tls_key = ssl_key_pem
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &GQLExt{
|
|
|
|
return &GQLExt{
|
|
|
|
|
|
|
|
State: state,
|
|
|
|
Listen: listen,
|
|
|
|
Listen: listen,
|
|
|
|
resolver_reads: map[uuid.UUID]uuid.UUID{},
|
|
|
|
resolver_reads: map[uuid.UUID]uuid.UUID{},
|
|
|
|
resolver_chans: map[uuid.UUID]chan *ReadResultSignal{},
|
|
|
|
resolver_chans: map[uuid.UUID]chan *ReadResultSignal{},
|
|
|
|