mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
copy, added proc info to reply message
This commit is contained in:
parent
f78647196d
commit
c86e513cc0
1 changed files with 20 additions and 15 deletions
|
@ -142,7 +142,7 @@ func (m methodREQCopySrc) handler(proc process, message Message, node string) ([
|
|||
|
||||
proc.toRingbufferCh <- []subjectAndMessage{sam}
|
||||
|
||||
replyData := fmt.Sprintf("info: succesfully initiated copy process: procName=%v, srcNode=%v, srcPath=%v, dstNode=%v, dstPath=%v, starting sub process=%v for the actual copying\n", copySrcSubProc.processName, node, SrcFilePath, DstNode, DstFilePath, subProcessName)
|
||||
replyData := fmt.Sprintf("info: succesfully initiated copy source process: procName=%v, srcNode=%v, srcPath=%v, dstNode=%v, dstPath=%v, starting sub process=%v for the actual copying\n", copySrcSubProc.processName, node, SrcFilePath, DstNode, DstFilePath, subProcessName)
|
||||
|
||||
newReplyMessage(proc, message, []byte(replyData))
|
||||
|
||||
|
@ -158,20 +158,6 @@ type copyInitialData struct {
|
|||
DstFile string
|
||||
}
|
||||
|
||||
func copySrcProcFunc(proc process) func(context.Context, chan Message) error {
|
||||
pf := func(ctx context.Context, procFuncCh chan Message) error {
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
log.Printf(" * copySrcProcFunc ended: %v\n", proc.processName)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
return pf
|
||||
}
|
||||
|
||||
// ----
|
||||
|
||||
type methodREQCopyDst struct {
|
||||
|
@ -228,12 +214,31 @@ func (m methodREQCopyDst) handler(proc process, message Message, node string) ([
|
|||
// The process will be killed when the context expires.
|
||||
go copyDstSubProc.spawnWorker()
|
||||
|
||||
fp := filepath.Join(cia.DstDir, cia.DstFile)
|
||||
replyData := fmt.Sprintf("info: succesfully initiated copy source process: procName=%v, srcNode=%v, dstPath=%v, starting sub process=%v for the actual copying\n", copyDstSubProc.processName, node, fp, subProcessName)
|
||||
|
||||
newReplyMessage(proc, message, []byte(replyData))
|
||||
|
||||
}()
|
||||
|
||||
ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID))
|
||||
return ackMsg, nil
|
||||
}
|
||||
|
||||
func copySrcProcFunc(proc process) func(context.Context, chan Message) error {
|
||||
pf := func(ctx context.Context, procFuncCh chan Message) error {
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
log.Printf(" * copySrcProcFunc ended: %v\n", proc.processName)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
return pf
|
||||
}
|
||||
|
||||
func copyDstProcFunc(proc process) func(context.Context, chan Message) error {
|
||||
pf := func(ctx context.Context, procFuncCh chan Message) error {
|
||||
|
||||
|
|
Loading…
Reference in a new issue