From fe78d6c070588fd9560decdc2a8adca052f71a1f Mon Sep 17 00:00:00 2001 From: postmannen Date: Tue, 14 Jun 2022 08:45:34 +0200 Subject: [PATCH] sub procs req use the same logic as normal req's for validation --- requests.go | 3 ++- requests_copy.go | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/requests.go b/requests.go index 5accf69..d981488 100644 --- a/requests.go +++ b/requests.go @@ -351,7 +351,8 @@ func (m Method) GetReplyMethods() []Method { // as input argument. func (m Method) getHandler(method Method) methodHandler { ma := m.GetMethodsAvailable() - mh := ma.Methodhandlers[method] + mh, _ := ma.CheckIfExists(method) + // mh := ma.Methodhandlers[method] return mh } diff --git a/requests_copy.go b/requests_copy.go index 761f68e..2c37f1a 100644 --- a/requests_copy.go +++ b/requests_copy.go @@ -240,7 +240,7 @@ func copySrcSubHandler(cia copyInitialData) func(process, Message, string) ([]by // HERE! // 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 { case <-proc.ctx.Done(): @@ -299,15 +299,20 @@ func copyDstProcSubFunc(proc process, cia copyInitialData, message Message) func ReplyMethod: REQNone, } - sub := Subject{ - ToNode: string(message.FromNode), - Event: EventACK, - Method: cia.SrcMethod, - } + // sub := Subject{ + // ToNode: string(message.FromNode), + // Event: EventACK, + // Method: cia.SrcMethod, + // } + // + // sam := subjectAndMessage{ + // Subject: sub, + // Message: msg, + // } - sam := subjectAndMessage{ - Subject: sub, - Message: msg, + sam, err := newSubjectAndMessage(msg) + if err != nil { + log.Fatalf("copyDstProcSubFunc: newSubjectAndMessage failed: %v\n", err) } proc.toRingbufferCh <- []subjectAndMessage{sam}