1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-01-07 04:49:17 +00:00

sub procs req use the same logic as normal req's for validation

This commit is contained in:
postmannen 2022-06-14 08:45:34 +02:00
parent c4e384b987
commit fe78d6c070
2 changed files with 16 additions and 10 deletions

View file

@ -351,7 +351,8 @@ func (m Method) GetReplyMethods() []Method {
// as input argument. // as input argument.
func (m Method) getHandler(method Method) methodHandler { func (m Method) getHandler(method Method) methodHandler {
ma := m.GetMethodsAvailable() ma := m.GetMethodsAvailable()
mh := ma.Methodhandlers[method] mh, _ := ma.CheckIfExists(method)
// mh := ma.Methodhandlers[method]
return mh return mh
} }

View file

@ -240,7 +240,7 @@ func copySrcSubHandler(cia copyInitialData) func(process, Message, string) ([]by
// HERE! // HERE!
// We should receive a ready message generated by the procFunc of Dst. // We should receive a ready message generated by the procFunc of Dst.
fmt.Printf("\n-----------------RECEIVED COPY READY MESSAGE------------------\n\n") fmt.Printf("\n-----------------RECEIVED COPY READY MESSAGE IN copySrcSubHandler------------------\n\n")
select { select {
case <-proc.ctx.Done(): case <-proc.ctx.Done():
@ -299,15 +299,20 @@ func copyDstProcSubFunc(proc process, cia copyInitialData, message Message) func
ReplyMethod: REQNone, ReplyMethod: REQNone,
} }
sub := Subject{ // sub := Subject{
ToNode: string(message.FromNode), // ToNode: string(message.FromNode),
Event: EventACK, // Event: EventACK,
Method: cia.SrcMethod, // Method: cia.SrcMethod,
} // }
//
// sam := subjectAndMessage{
// Subject: sub,
// Message: msg,
// }
sam := subjectAndMessage{ sam, err := newSubjectAndMessage(msg)
Subject: sub, if err != nil {
Message: msg, log.Fatalf("copyDstProcSubFunc: newSubjectAndMessage failed: %v\n", err)
} }
proc.toRingbufferCh <- []subjectAndMessage{sam} proc.toRingbufferCh <- []subjectAndMessage{sam}