mirror of
https://github.com/postmannen/ctrl.git
synced 2025-03-31 01:24:31 +00:00
added so you can define requests without a method, and just have a procFunc.
This commit is contained in:
parent
8ac14720cc
commit
894bdf2554
3 changed files with 16 additions and 12 deletions
|
@ -535,7 +535,7 @@ func executeHandler(p process, message Message, thisNode string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case !runAsScheduled:
|
case !runAsScheduled && p.handler != nil:
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
_, err = p.handler(p, message, thisNode)
|
_, err = p.handler(p, message, thisNode)
|
||||||
|
|
|
@ -132,7 +132,7 @@ func (p *processes) Start(proc process) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if proc.configuration.StartProcesses.EnableKeyUpdates {
|
if proc.configuration.StartProcesses.EnableKeyUpdates {
|
||||||
proc.startup.startProcess(proc, KeysRequestUpdate, procFuncKeysRequestUpdate)
|
proc.startup.startProcess(proc, KeysRequestUpdatePublisher, procFuncKeysRequestUpdate)
|
||||||
proc.startup.startProcess(proc, KeysDeliverUpdate, nil)
|
proc.startup.startProcess(proc, KeysDeliverUpdate, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
24
requests.go
24
requests.go
|
@ -129,6 +129,8 @@ const (
|
||||||
KeysRequestUpdate Method = "keysRequestUpdate"
|
KeysRequestUpdate Method = "keysRequestUpdate"
|
||||||
// REQKeysRequestUpdatePublisher send the current hash of the locally stored public keys to
|
// REQKeysRequestUpdatePublisher send the current hash of the locally stored public keys to
|
||||||
// the central key server, and get an update from central if needed.
|
// 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"
|
KeysDeliverUpdate Method = "keysDeliverUpdate"
|
||||||
// REQKeysAllow
|
// REQKeysAllow
|
||||||
KeysAllow Method = "keysAllow"
|
KeysAllow Method = "keysAllow"
|
||||||
|
@ -193,16 +195,18 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
|
||||||
// The hello publisher will not subscribe for messages, it will
|
// The hello publisher will not subscribe for messages, it will
|
||||||
// only start a procFunc, so we we don't need a handler with a method,
|
// only start a procFunc, so we we don't need a handler with a method,
|
||||||
// so we set it to nil.
|
// so we set it to nil.
|
||||||
HelloPublisher: HandlerFunc(nil),
|
HelloPublisher: HandlerFunc(nil),
|
||||||
ErrorLog: HandlerFunc(methodErrorLog),
|
ErrorLog: HandlerFunc(methodErrorLog),
|
||||||
HttpGet: HandlerFunc(methodHttpGet),
|
HttpGet: HandlerFunc(methodHttpGet),
|
||||||
HttpGetScheduled: HandlerFunc(methodHttpGetScheduled),
|
HttpGetScheduled: HandlerFunc(methodHttpGetScheduled),
|
||||||
TailFile: HandlerFunc(methodTailFile),
|
TailFile: HandlerFunc(methodTailFile),
|
||||||
PublicKey: HandlerFunc(methodPublicKey),
|
PublicKey: HandlerFunc(methodPublicKey),
|
||||||
KeysRequestUpdate: HandlerFunc(methodKeysRequestUpdate),
|
|
||||||
KeysDeliverUpdate: HandlerFunc(methodKeysReceiveUpdate),
|
KeysRequestUpdatePublisher: HandlerFunc(methodKeysRequestUpdate),
|
||||||
KeysAllow: HandlerFunc(methodKeysAllow),
|
KeysRequestUpdate: HandlerFunc(nil),
|
||||||
KeysDelete: HandlerFunc(methodKeysDelete),
|
KeysDeliverUpdate: HandlerFunc(methodKeysReceiveUpdate),
|
||||||
|
KeysAllow: HandlerFunc(methodKeysAllow),
|
||||||
|
KeysDelete: HandlerFunc(methodKeysDelete),
|
||||||
|
|
||||||
AclRequestUpdate: HandlerFunc(methodAclRequestUpdate),
|
AclRequestUpdate: HandlerFunc(methodAclRequestUpdate),
|
||||||
AclDeliverUpdate: HandlerFunc(methodAclDeliverUpdate),
|
AclDeliverUpdate: HandlerFunc(methodAclDeliverUpdate),
|
||||||
|
|
Loading…
Add table
Reference in a new issue