From f1e9da0594463de2270b7e8d6240d9bf4413d2b2 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期四, 12 十二月 2019 10:41:10 +0800
Subject: [PATCH] bug fixed

---
 proc/single.go |   39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/proc/single.go b/proc/single.go
index 42d15b8..7d7d1a0 100644
--- a/proc/single.go
+++ b/proc/single.go
@@ -5,7 +5,36 @@
 	"analysis/util"
 	"analysis/work"
 	"context"
+	"strings"
 )
+
+func slaveProc(ctx context.Context, typ string, id string, gpu int, shm bool) bool {
+	name, ok := prepare(typ, gpu)
+	if !ok {
+		logo.Errorln("SLAVEPROC ERROR: ", name)
+		return false
+	}
+
+	if id != util.FakeSdkID {
+		build(name, id, shm)
+		runAll(ctx)
+	} else {
+
+		util.InitDBAPI()
+
+		sdks := util.SDKInfo()
+		// 棣栧厛杩愯yolo
+		for k, v := range sdks {
+			if strings.EqualFold(typ, v.SdkType) {
+				build(v.SdkType, v.IpcId, shm)
+				logo.Infof("SINGLE PROC ID %s TYPE %s\n", k, v.IpcId, v.SdkType)
+			}
+		}
+
+		runAll(ctx)
+	}
+	return true
+}
 
 // SingleRole 鍗曡繘绋�
 func SingleRole(ctx context.Context, typ string, ipcID string, gpu int, shm bool) bool {
@@ -24,7 +53,7 @@
 	return ret
 }
 
-func sdkProc(ctx context.Context, typ string, gpu int, shm bool) {
+func sdkProc(ctx context.Context, typ string, gpu int, shm bool) bool {
 	if typ != util.FeatYolo && typ != util.FeatFace {
 		logo.Errorf("NO THIS SDK PROC SDKPROC : ", typ)
 	}
@@ -44,7 +73,7 @@
 	for k, v := range res {
 		if !v {
 			logo.Errorln(k, " type proc failed to init")
-			return
+			return false
 		}
 	}
 
@@ -60,9 +89,10 @@
 	}
 
 	runAll(ctx)
+	return false
 }
 
-func allProc(ctx context.Context, gpu int, shm bool) {
+func allProc(ctx context.Context, gpu int, shm bool) bool {
 	var res []bool
 
 	for _, v := range work.SDK {
@@ -73,7 +103,7 @@
 	for k, v := range res {
 		if !v {
 			logo.Errorln(k, " ALL PROC FAILED TO INIT")
-			return
+			return false
 		}
 	}
 
@@ -95,4 +125,5 @@
 	}
 
 	runAll(ctx)
+	return true
 }

--
Gitblit v1.8.0