mirror of
https://github.com/postmannen/ctrl.git
synced 2025-03-31 01:24:31 +00:00
added so the method None can be used to only start a procFunc for startup processes
This commit is contained in:
parent
2f1f2ea28b
commit
714abc85cb
4 changed files with 9 additions and 11 deletions
|
@ -115,7 +115,7 @@ func newSubject(method Method, node string) Subject {
|
|||
ma := method.GetMethodsAvailable()
|
||||
_, ok := ma.CheckIfExists(method)
|
||||
//mh, ok := ma.Methodhandlers[method]
|
||||
if !ok {
|
||||
if !ok && method != None {
|
||||
log.Printf("error: newSubject: no Event type specified for the method: %v\n", method)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
|
@ -132,7 +132,8 @@ func (p *processes) Start(proc process) {
|
|||
}
|
||||
|
||||
if proc.configuration.StartProcesses.EnableKeyUpdates {
|
||||
proc.startup.startProcess(proc, KeysRequestUpdatePublisher, procFuncKeysRequestUpdate)
|
||||
// The key update on the client is only a proc func that publish requests.
|
||||
proc.startup.startProcess(proc, None, procFuncKeysRequestUpdate)
|
||||
proc.startup.startProcess(proc, KeysDeliverUpdate, nil)
|
||||
}
|
||||
|
||||
|
|
12
requests.go
12
requests.go
|
@ -127,9 +127,6 @@ const (
|
|||
// REQKeysRequestUpdate will receive all the messages of the current hash of all public keys
|
||||
// a node have stored, and send out an update if needed..
|
||||
KeysRequestUpdate Method = "keysRequestUpdate"
|
||||
// REQKeysRequestUpdatePublisher send the current hash of the locally stored public keys to
|
||||
// the central key server, and get an update from central if needed.
|
||||
KeysRequestUpdatePublisher Method = "keysRequestUpdatePublisher"
|
||||
// REQKeysDeliverUpdate will deliver the public from central to a node.
|
||||
KeysDeliverUpdate Method = "keysDeliverUpdate"
|
||||
// REQKeysAllow
|
||||
|
@ -202,11 +199,10 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
|
|||
TailFile: Handler(methodTailFile),
|
||||
PublicKey: Handler(methodPublicKey),
|
||||
|
||||
KeysRequestUpdatePublisher: Handler(methodKeysRequestUpdate),
|
||||
KeysRequestUpdate: Handler(nil),
|
||||
KeysDeliverUpdate: Handler(methodKeysReceiveUpdate),
|
||||
KeysAllow: Handler(methodKeysAllow),
|
||||
KeysDelete: Handler(methodKeysDelete),
|
||||
KeysRequestUpdate: Handler(methodKeysRequestUpdate),
|
||||
KeysDeliverUpdate: Handler(methodKeysDeliverUpdate),
|
||||
KeysAllow: Handler(methodKeysAllow),
|
||||
KeysDelete: Handler(methodKeysDelete),
|
||||
|
||||
AclRequestUpdate: Handler(methodAclRequestUpdate),
|
||||
AclDeliverUpdate: Handler(methodAclDeliverUpdate),
|
||||
|
|
|
@ -60,6 +60,7 @@ func methodKeysRequestUpdate(proc process, message Message, node string) ([]byte
|
|||
// time a node had done an update.
|
||||
|
||||
ctx, _ := getContextForMethodTimeout(proc.ctx, message)
|
||||
_ = node
|
||||
|
||||
proc.processes.wg.Add(1)
|
||||
go func() {
|
||||
|
@ -166,7 +167,7 @@ func procFuncKeysRequestUpdate(ctx context.Context, proc process, procFuncCh cha
|
|||
// ----
|
||||
|
||||
// Handler to receive the public keys from a central server.
|
||||
func methodKeysReceiveUpdate(proc process, message Message, node string) ([]byte, error) {
|
||||
func methodKeysDeliverUpdate(proc process, message Message, node string) ([]byte, error) {
|
||||
// Get a context with the timeout specified in message.MethodTimeout.
|
||||
|
||||
ctx, _ := getContextForMethodTimeout(proc.ctx, message)
|
||||
|
|
Loading…
Add table
Reference in a new issue